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
[Caml-list] ocamllex/yacc and camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-17 (09:42)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] ocamllex/yacc and camlp4
On Thu, 2004-06-17 at 12:04, William Lovas wrote:
> On Thu, Jun 17, 2004 at 12:48:01AM +0200, Pierre Weis wrote:
> > In conclusion: pure Camlp4 implementation of ocamllex/ocamlyacc is
> > still an interesting and challenging progamming task for the next few
> > years, if you (or someone else) had the will and time to provide two
> > ``great camlp4 examples'' to the rest of us...
> Is such a thing even possible?  I thought ocamllex/ocamlyacc produced
> parsers for LALR(1) languages while camlp4 produced parsers for LL(k)
> languages.  These two sets do not bear a subset relation in either
> direction, so i would think it impossible to completely implement either
> tool in terms of the other.  Have i misunderstood something?

Yes: there is no need for camlp4 to generate lexers and
parsers replacing those you'd build with ocamllex/ocamlyacc,
the need is to replace the ocamllex/ocamlyacc parsers used
to scan your lexer/grammar specifications -- and that
can easily be done by camlp4 (and for lexers certainly
has been done several times eg ulex).

Having read such specifications 'inline' in Ocaml code,
actually generating the parsers/lexers to implement
the semantics can easily be done by camlp4 by simply
calling an external function.

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: