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] debugging ocamllex/ocamlyacc specifications?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-01-07 (08:21)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] debugging ocamllex/ocamlyacc specifications?
On Fri, 28 Dec 2001, Will Benton wrote:
> Hello, all.  I am writing a simple interpreter for fun but am having
> trouble with ocamllex and ocamlyacc.  To test my lexer and parser, I am
> using the test program from the desk calculator example in the manual, but
> I when I type in an expression and press EOL, it does nothing (my "main"
> rule in the parser is "exp EOL"); I know it's doing something because
> if I type in a garbage expression, it gives me a parse error
> exception.

Maybe you only need to flush the output channel after printing results?

> When I type in an expression and press EOF, on the other hand,
> it gives me a Failure("lexing: empty token") exception.

I don't know what your parser looks like, but you might have to add an
appropriate rule for "EOF" so that it isn't considered as a parse error
anymore and quits the program instead.

Markus Mottl

Markus Mottl                                   
Austrian Research Institute
for Artificial Intelligence        
Bug reports:  FAQ:
To unsubscribe, mail  Archives: