caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] debugging ocamllex/ocamlyacc specifications?
@ 2001-12-28  6:40 Will Benton
  2001-12-28 11:05 ` Markus Mottl
  0 siblings, 1 reply; 2+ messages in thread
From: Will Benton @ 2001-12-28  6:40 UTC (permalink / raw)
  To: caml-list

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

If anyone knows what might cause these problems, that would be nice to
know.  Otherwise, if there is some way to put the lexer and parser in a
"verbose debug mode", detailing what tokens are produced and/or what
productions are applied, that would be really helpful.


thanks,
wb

---
Will Benton      | "Nicht wie die Welt ist, ist das Mystische, 
willb@acm.org    |  sondern daß sie ist." --L. Wittgenstein

-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] debugging ocamllex/ocamlyacc specifications?
  2001-12-28  6:40 [Caml-list] debugging ocamllex/ocamlyacc specifications? Will Benton
@ 2001-12-28 11:05 ` Markus Mottl
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Mottl @ 2001-12-28 11:05 UTC (permalink / raw)
  To: Will Benton; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-07  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-28  6:40 [Caml-list] debugging ocamllex/ocamlyacc specifications? Will Benton
2001-12-28 11:05 ` Markus Mottl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).