To: mottl@miss.wu-wien.ac.at
Subject: Re: lexer, parser
In-Reply-To: Your message of "Sat, 12 Jun 1999 13:02:58 +0100 (MET DST)"
<199906121102.NAA30678@miss.wu-wien.ac.at>
Message-Id: <19990615110150N.garrigue@kurims.kyoto-u.ac.jp>
Date: Tue, 15 Jun 1999 11:01:50 +0900
From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
From: Markus Mottl <mottl@miss.wu-wien.ac.at>
> 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
---------------------------------------------------------------------------
Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp
<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:23 MET