Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Ocamllex/Ocamlyacc feature request
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <brian.hurt@q...>
Subject: [Caml-list] Ocamllex/Ocamlyacc feature request

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