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] On ocamlyacc and ocamllex
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@m...>
Subject: Re: [Caml-list] On ocamlyacc and ocamllex
Christian Lindig wrote:

> > I agree that it may be somewhat easier for the parser generator, but I
> > find that separating the token type definition from the grammar
> > definition can be justified using quantitative technical arguments.
> I agree that this alternative avoids the dependency of the type
> definition on the grammar. But I am not sure that manually keeping the
> type definition and the %token declarations in the parser in sync is
> better than automatic recompiles or a little Make hack.

Adding the tokens to the .mly file is a pain.
I have two other files which also need to list all tokens:
one to print them, and one to extract the source file/line/column
information. Both have to be manually tracked anyhow.

Worse, the %token command makes a normal union: how to use
polymorphic variants instead?

Even worse, the lexer and parser are improperly connected,
with the parser incorrectly taking a lexer and lexbuf as
arguments -- a right pain if you want to preprocess the
tokens. I have to create a dummy lexbuf/lexer to drive
the parser. The parser should take a callback function
as an argument. A patch to make this alternative calling
technique available would be useful.

John (Max) Skaller, 
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix
Literate Programming tool Interscript
Bug reports:  FAQ:
To unsubscribe, mail  Archives: