caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Hurt <brian.hurt@qlogic.com>
To: Ocaml Mailing List <caml-list@inria.fr>
Subject: [Caml-list] Ocamllex/Ocamlyacc feature request
Date: Wed, 28 May 2003 16:03:49 -0500 (CDT)	[thread overview]
Message-ID: <Pine.LNX.4.33.0305281557180.32567-100000@eagle.ancor.com> (raw)


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


             reply	other threads:[~2003-05-28 20:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-28 21:03 Brian Hurt [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0305281557180.32567-100000@eagle.ancor.com \
    --to=brian.hurt@qlogic.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).