Re: lexer, parser

From: Jacques GARRIGUE (
Date: Tue Jun 15 1999 - 04:01:50 MET DST

Subject: Re: lexer, parser
In-Reply-To: Your message of "Sat, 12 Jun 1999 13:02:58 +0100 (MET DST)"
Message-Id: <>
Date: Tue, 15 Jun 1999 11:01:50 +0900
From: Jacques GARRIGUE <>

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>

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:23 MET