Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: lexer, parser
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-06-15 (20:47)
From: Jacques GARRIGUE <garrigue@k...>
Subject: Re: lexer, parser
From: Markus Mottl <>

> Execution of "semantics" is also much faster than versions that use
> algebraic datatypes and pattern matching, because here we only have to
> call methods (wrapped in the functions of the stream) on objects instead
> of match abstract syntax trees or else.

Sorry to answer pinpoint, but I just want to avoid a confusion.

In caml pattern-matching is much more efficient than calling a method.
Calling a method is a dynamic operation, involving looking-up a table
and calling a possibly curried function, while pattern-matching is
completely statically compiled.

OO may help you structure your program, but when algebraic datatypes
are handy, I would suggest sticking with them.

Jacques Garrigue      Kyoto University     garrigue at
		<A HREF=>JG</A>