Version française
Home     About     Download     Resources     Contact us    
Browse thread
Multiple Yacc-style Parsers in one application?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christian Rinderknecht <rinderkn@p...>
Subject: Re: Multiple Yacc-style Parsers in one application?
Hello Steve,

Last year I wrote in OCaml a software that had to deal with multiple
output/input files of a commercial tool, and hence needed up to six lexers
and parsers. The different formats were rather close (both lexically and
syntactically), but I wasn't able to share the lexers and the parsers
rules because:
  1) ocamllex generates an "open <Parser module name>" directive;
  2) ocamlyacc doesn't allow rule sharing.
Nevertheless, I shared a lot of semantic actions (defined in standalone
modules).

The first point could be solved if ocamllex produced a functor whose
argument signature would constrain the abstract syntax tree, but I am not
sure the underlying implementation of lexer buffers would then behave
soundly.

Best regards,


Christian

--------------------------------------------------------------------
Christian Rinderknecht          Christian.Rinderknecht@polyspace.com
PolySpace Technologies          Tel: 04.76.61.54.17
c/o INRIA                       Fax: 04.76.61.54.09
655, Av. de l'Europe            http://www.polyspace.com/
F-38330 Montbonnot St Martin

On Fri, 23 Jun 2000, Steve Stevenson wrote:

> I'm interested in hearing experiences from people who have used
> multiple yacc parsers in one application. I assume that they would
> share one lexer buffer (but maybe not). Do you have to manipulate the
> lexical world to deal with the one-lookahead?