|Use of ocamlyacc David.Monniaux@ens-lyon.fr (1997-02-27)|
|From:||David.Monniaux@ens-lyon.fr (David Monniaux)|
|Date:||27 Feb 1997 00:32:44 -0500|
|Organization:||Ecole Normale Superieure de Lyon, France|
I'm writing a parser for the LAX sample language (simplified Pascal for
compiling class projects), as a part of a compiler in Objective CAML
(a ML-family language). I use the yacc-like ocamlyacc LALR(1) parser
generator, together with the ocamllex lexer generator.
I'm having trouble with ocamlyacc error recovery. As it's a new feature
added between caml-light and ocaml, it is very badly documented. As
syntax error recovery in the camllight/ocaml compilers is spartan (they
discard tokens up to the next ";;" roughly), I can't base myself upon
the parsers in those compilers.
My question is: how do you use the "error" token, which is present
in ocamlyacc, so that the parser recovers from errors and doesn't issue
uncaught Parsing.Parse_error exceptions?
Thanks in advance. Please answer by email - if I get working answers,
I'll post a sum-up afterwards.
David, CS student at ENS-Lyon
Return to the
Search the comp.compilers archives again.