Use of ocamlyacc

David.Monniaux@ens-lyon.fr (David Monniaux)
27 Feb 1997 00:32:44 -0500

          From comp.compilers

Related articles
Use of ocamlyacc David.Monniaux@ens-lyon.fr (1997-02-27)
| List of all articles for this month |

From: David.Monniaux@ens-lyon.fr (David Monniaux)
Newsgroups: comp.compilers,comp.lang.ml
Date: 27 Feb 1997 00:32:44 -0500
Organization: Ecole Normale Superieure de Lyon, France
Keywords: OOP, yacc

Hi,


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
--
http://www.ens-lyon.fr/~dmonniau
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.