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: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] some comments on ocaml{lex,yacc} from a novice's POV
On Sat, Apr 02, 2005 at 04:38:51PM +0900, Jacques Garrigue wrote:
> From: "Jack Andrews" <effbiae@ivorykite.com>
[...]
> > # calclex.py
> > import lex
> > tokens = ( 'NUMBER', 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'LPAREN', 'RPAREN',)
> > t_PLUS    = r'\+'  # in python, the r prefix to a string literal
> > t_MINUS   = r'-'   #  means as-is.  r'\' in python is "\\" in c
> > [snip]
> 
> Interestingly, your example corresponds exactly to the one in the
> ocaml tutorial, where it is solved using stream parsers.
> Stream parsers are a bit more involved than just writing yacc rules,
> but they give you more control on how to combine rules (you can write
> parser combinators.) And they are completely integrated in the
> language using camlp4.

...which lacks adequate documentation... :(

Btw: Is the campl4-tutorial-project growing?

Ciao,
   Oliver