caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Ocamllex/Ocamlyacc feature request
@ 2003-05-28 21:03 Brian Hurt
  2003-05-29 10:16 ` Ken Wakita
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Hurt @ 2003-05-28 21:03 UTC (permalink / raw)
  To: Ocaml Mailing List


Flex and Bison have an option to automatically output debugging
information to stdout in the generated code.

For flex, the option is -d, and documented thusly:

>       -d     makes the generated  scanner  run  in  debug  mode.
>              Whenever  a  pattern  is  recognized and the global
>              yy_flex_debug is non-zero (which is  the  default),
>              the  scanner  will  write  to  stderr a line of the
>              form:
>
>                  --accepting rule at line 53 ("the matched text")
>
>              The line number refers to the location of the  rule
>              in  the  file  defining the scanner (i.e., the file
>              that was fed to flex).  Messages are also generated
>              when  the  scanner  backs  up,  accepts the default
>              rule, reaches the  end  of  its  input  buffer  (or
>              encounters  a  NUL; at this point, the two look the
>              same as far as the scanner's concerned), or reaches
>              an end-of-file.

The Bison option is -t, and documented thusly:

>    Each step taken by the parser when `yydebug' is nonzero produces a
> line or two of trace information, written on `stderr'.  The trace
> messages tell you these things:
>
>    * Each time the parser calls `yylex', what kind of token was read.
>
>    * Each time a token is shifted, the depth and complete contents of
>      the state stack (*note Parser States::.).
>
>    * Each time a rule is reduced, which rule it is, and the complete
>      contents of the state stack afterward.

These are incredibly usefull for debugging your parsers.

Brian


-------------------
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] 6+ messages in thread

end of thread, other threads:[~2003-06-04 17:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-28 21:03 [Caml-list] Ocamllex/Ocamlyacc feature request Brian Hurt
2003-05-29 10:16 ` Ken Wakita
2003-05-29 12:03   ` Damien
2003-05-29 13:07     ` Luc Maranget
2003-06-04  9:19   ` [Caml-list] Syntax error Lukasz Lew
2003-06-04 17:25     ` Stefan Heimann

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