caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] debugging ocamlyacc grammars
@ 2003-09-29  4:53 Rafael 'Dido' Sevilla
       [not found] ` <r771xtzohjg.fsf@brouilly.inria.fr>
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael 'Dido' Sevilla @ 2003-09-29  4:53 UTC (permalink / raw)
  To: ocaml-list

I'm attempting to debug a grammar for ocamlyacc i'm in the process of
writing, and am wondering if there's a feature there similar to what
happens when you #define YYDEBUG 1 and set yydebug = 1 with Bison or
Yacc, giving a dump of the parser's state, stack, and read tokens, which
is invaluable for debugging.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] debugging ocamlyacc grammars
       [not found] ` <r771xtzohjg.fsf@brouilly.inria.fr>
@ 2003-09-29 13:27   ` James Leifer
  2003-09-30  4:45     ` Rafael 'Dido' Sevilla
  0 siblings, 1 reply; 4+ messages in thread
From: James Leifer @ 2003-09-29 13:27 UTC (permalink / raw)
  To: caml-list

"Rafael 'Dido' Sevilla" <dido@imperium.ph> writes:

> I'm attempting to debug a grammar for ocamlyacc i'm in the process of
> writing, and am wondering if there's a feature there similar to what
> happens when you #define YYDEBUG 1 and set yydebug = 1 with Bison or
> Yacc, giving a dump of the parser's state, stack, and read tokens, which
> is invaluable for debugging.

Do you mean the parser.output file produced when you use the -v
option?

    ocamlyacc -v foo.mly

-James

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] debugging ocamlyacc grammars
  2003-09-29 13:27   ` James Leifer
@ 2003-09-30  4:45     ` Rafael 'Dido' Sevilla
  2003-09-30  5:45       ` Kenneth Knowles
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael 'Dido' Sevilla @ 2003-09-30  4:45 UTC (permalink / raw)
  To: caml-list

On Mon, Sep 29, 2003 at 03:27:24PM +0200, James Leifer wrote:
> Do you mean the parser.output file produced when you use the -v
> option?
> 
>     ocamlyacc -v foo.mly
> 

No.  I mean that once the parser is *already running*, you get a
complete trace of the entire action of the parser for some particular
input.  What states it enters as it reads particular input tokens, the
contents of its stack as it enters and leaves states, and so on.  This
is possible with Bison and Yacc, and I've used it before to debug
grammars written with those tools.  I read nothing in Ocamlyacc's (very
meager) documentation that indicates how one should do this or if it is
even possible at all.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] debugging ocamlyacc grammars
  2003-09-30  4:45     ` Rafael 'Dido' Sevilla
@ 2003-09-30  5:45       ` Kenneth Knowles
  0 siblings, 0 replies; 4+ messages in thread
From: Kenneth Knowles @ 2003-09-30  5:45 UTC (permalink / raw)
  To: Rafael 'Dido' Sevilla; +Cc: caml-list


>From the manual:

"At run-time, the ocamlyacc-generated parser can be debugged by setting the p
option in the OCAMLRUNPARAM environment variable (see section 10.2). This causes
the pushdown automaton executing the parser to print a trace of its action
(tokens shifted, rules reduced, etc). The trace mentions rule numbers and state
numbers that can be interpreted by looking at the file grammar.output generated
by ocamlyacc -v."

-Kenn

On Tue, Sep 30, 2003 at 12:45:14PM +0800, Rafael 'Dido' Sevilla wrote:
> On Mon, Sep 29, 2003 at 03:27:24PM +0200, James Leifer wrote:
> > Do you mean the parser.output file produced when you use the -v
> > option?
> > 
> >     ocamlyacc -v foo.mly
> > 
> 
> No.  I mean that once the parser is *already running*, you get a
> complete trace of the entire action of the parser for some particular
> input.  What states it enters as it reads particular input tokens, the
> contents of its stack as it enters and leaves states, and so on.  This
> is possible with Bison and Yacc, and I've used it before to debug
> grammars written with those tools.  I read nothing in Ocamlyacc's (very
> meager) documentation that indicates how one should do this or if it is
> even possible at all.
> 
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2003-09-30  5:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-29  4:53 [Caml-list] debugging ocamlyacc grammars Rafael 'Dido' Sevilla
     [not found] ` <r771xtzohjg.fsf@brouilly.inria.fr>
2003-09-29 13:27   ` James Leifer
2003-09-30  4:45     ` Rafael 'Dido' Sevilla
2003-09-30  5:45       ` Kenneth Knowles

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