Version française
Home     About     Download     Resources     Contact us    
Browse thread
bug in "developing applications with objective caml" (english translation)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Erik de Castro Lopo <ocaml-erikd@m...>
Subject: Re: [Caml-list] Re: some comments on ocaml{lex,yacc} from a novice's POV
On Mon, 4 Apr 2005 13:42:03 +1000 (EST)
"Jack Andrews" <effbiae@ivorykite.com> wrote:

> here's the usual calc example that generates a parser:
> 
>  (define expr-parser
>   (lalr-parser
>    ; Terminal symbols
>    (ID + - * /)
>    ; Productions
>    (e (e + t)    : (+ $1 $3)
>       (e - t)    : (- $1 $3)
>       (t)        : $1)
>    (t (t * f)    : (* $1 $3)
>       (t / f)    : (/ $1 $3)
>       (f)        : $1)
>    (f (ID)       : $1)))
> 
> isn't that nice?!?

Yes.

> compare with caml solutions? compare with any other solution?

There are parsers for Haskell which would compare very favourably 
with your lisp parser. I haven't used them myself but I've seen 
example code somewhere.

> i'm told there are good scheme compilers.

Since scheme is a dynamically typed language, scheme compilers are
unlikely to ever produce code as fast as a compiler for a statically 
typed langugae like ocaml.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
" ... new TV ad for Microsoft's Internet Explorer e-mail program which
uses the musical theme of the "Confutatis Maledictis" from Mozart's
Requiem. "Where do you want to go today?" is the cheery line on the
screen, while the chorus sings "Confutatis maledictis, flammis acribus
addictis,". This translates to "The damned and accursed are convicted
to the flames of hell."