Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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.

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr