* Multiple Yacc-style Parsers in one application?
@ 2000-06-23 12:49 Steve Stevenson
2000-06-23 16:46 ` Chris Tilt
2000-06-26 10:05 ` Christian Rinderknecht
0 siblings, 2 replies; 3+ messages in thread
From: Steve Stevenson @ 2000-06-23 12:49 UTC (permalink / raw)
To: caml-list
Good morning.
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?
Any experiences, stories, etc, greatly appreciated.
Best regards,
steve
-----
Steve (really "D. E.") Stevenson Assoc Prof
Department of Computer Science, Clemson, (864)656-5880.mabell
Support V&V mailing list: ivandv@cs.clemson.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Multiple Yacc-style Parsers in one application?
2000-06-23 12:49 Multiple Yacc-style Parsers in one application? Steve Stevenson
@ 2000-06-23 16:46 ` Chris Tilt
2000-06-26 10:05 ` Christian Rinderknecht
1 sibling, 0 replies; 3+ messages in thread
From: Chris Tilt @ 2000-06-23 16:46 UTC (permalink / raw)
To: Steve Stevenson; +Cc: caml-list
Steve,
When I discovered the lex/yacc tools for caml I was very impressed.
They are implemented in a completely functional way, with no magic
entry points or expected symbols, etc. We have an application with
two yacc parsers, each with their own lexer. Since the yacc-created
parser takes a lex buffer and a lexer function, you can build any
number of co-existing parsers. Each lexer also has its own name
space, so it's very different from the old C yacc/lex experience.
As a partial example of how the machinery works, here is a code
snippet (with no exception handling, which you need). The returned
document is of the type returned by the function "Xmlparse.document".
The cool part is that *any* of the left-hand-side productions can
be used as entry points for your parser. This makes it trivial to
parse, e.g. document fragments in this XML example.
let doc =
let lexbuf = Lexing.from_channel in_chan
in
Xmlparse.document Xmlscan.scan lexbuf
-Chris
P.S. Thanks to the CAML team for these great tools. We are building
our second industrial product with CAML 3.0 release.
Steve Stevenson wrote:
>
> Good morning.
>
> 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?
>
> Any experiences, stories, etc, greatly appreciated.
>
> Best regards,
>
> steve
> -----
> Steve (really "D. E.") Stevenson Assoc Prof
> Department of Computer Science, Clemson, (864)656-5880.mabell
> Support V&V mailing list: ivandv@cs.clemson.edu
--
Chris Tilt mailto:cet@webcriteria.com
CTO, WebCriteria, Inc. http://www.webcriteria.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Multiple Yacc-style Parsers in one application?
2000-06-23 12:49 Multiple Yacc-style Parsers in one application? Steve Stevenson
2000-06-23 16:46 ` Chris Tilt
@ 2000-06-26 10:05 ` Christian Rinderknecht
1 sibling, 0 replies; 3+ messages in thread
From: Christian Rinderknecht @ 2000-06-26 10:05 UTC (permalink / raw)
To: Steve Stevenson; +Cc: caml-list
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?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-06-26 10:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-23 12:49 Multiple Yacc-style Parsers in one application? Steve Stevenson
2000-06-23 16:46 ` Chris Tilt
2000-06-26 10:05 ` Christian Rinderknecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox