Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Mattias Waldau" <mattias.waldau@abc.se>
To: "Rafael 'Dido' Sevilla" <sevillar@team.ph.inter.net>,
	"Caml List" <caml-list@pauillac.inria.fr>
Subject: RE: [Caml-list] debugging an ocamlyacc parser
Date: Tue, 23 Oct 2001 07:42:51 +0200	[thread overview]
Message-ID: <AAEBJHFJOIPMMIILCEPBGEMKDDAA.mattias.waldau@abc.se> (raw)
In-Reply-To: <20011023101442.B17138@team.ph.inter.net>

I normally test the lexer and the parser separately.

The lexer is easy to test using a function like:

  let lexbuf = Lexing.from_channel file_channel in
  let result = ref [] in
  try
    while true do
      let next_token = Dtd_lexer.token lexbuf in
      result := next_token :: !result;
      if debug_lexer then Dtd_types.print next_token;
      if next_token = Dtd_types.EOF then raise Not_found
    done;
    List.rev (!result)
  with Not_found -> List.rev (!result)

For debugging the parser I set the -v flag to ocamlyacc and look at the
.parser file

/mattias

> -----Original Message-----
> From: owner-caml-list@pauillac.inria.fr
> [mailto:owner-caml-list@pauillac.inria.fr]On Behalf Of Rafael 'Dido'
> Sevilla
> Sent: Tuesday, October 23, 2001 4:15 AM
> To: Caml List
> Subject: [Caml-list] debugging an ocamlyacc parser
>
>
> Well, while my current ocamlyacc parser seems to be working pretty well,
> I'm just wondering if there's a debug mode available for
> ocamlyacc-generated parsers, like the debugging mode that Bison uses
> when you do a #define YYDEBUG, printing out all the states the parser
> goes through as it receives tokens from the lexer, so along with the
> generated y.output file I can see how it's working (or not working as
> the case may be).
>
> --
> Rafael R. Sevilla <sevillar@team.ph.inter.net>   +63(2)   8177746
> ext. 8311
> Programmer, Inter.Net Philippines                +63(917) 4458925
> http://dido.engr.internet.org.ph/                OpenPGP Key ID:
> 0x5CDA17D8
> -------------------
> 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

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


  reply	other threads:[~2001-10-23  5:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-23  2:14 Rafael 'Dido' Sevilla
2001-10-23  5:42 ` Mattias Waldau [this message]
2001-10-23  7:51 ` Hendrik Tews
2001-10-24 14:53 ` Xavier Leroy

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=AAEBJHFJOIPMMIILCEPBGEMKDDAA.mattias.waldau@abc.se \
    --to=mattias.waldau@abc.se \
    --cc=caml-list@pauillac.inria.fr \
    --cc=sevillar@team.ph.inter.net \
    /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