caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: dsb@prairienet.org
To: caml-list@inria.fr
Subject: sequence parser, revised syntax
Date: Mon, 9 Jul 2007 09:22:32 -0500 (CDT)	[thread overview]
Message-ID: <47259.192.17.3.107.1183990952.squirrel@mail.prairienet.org> (raw)

I have a noobie question about parsers.

The output of
  Grammar.Entry.print Pcaml.expr;;

contains several things that appear to be parsers
(this example in the revised syntax):

  | "let"; "module"; UIDENT; module_binding; "in"; SELF
  | "let"; OPT "rec"; LIST1 let_binding SEP "and"; "in"; SELF
  | "fun"; "["; LIST0 match_case SEP "|"; "]"
  | "fun"; ipatt; fun_def
  | "while"; SELF; "do"; "{"; sequence; "}"
  | "while"; SELF; "do"; LIST0 [ expr; ";" ]; warning_sequence; "done"
  | "object"; OPT class_self_patt; class_structure; "end" ]

but don't seem to be documented.  My current interest happens to be
sequence:

  open Pcaml;
  EXTEND
    expr: LEVEL "top" [
  [ "when"; test = expr; "do"; "{"; seq = sequence; "}"
    ->
      <:expr< if $test$ then ($list:seq$) else () >>
  ]];
  END;

but it doesn't seem to work:

  $ make stdlibr.cmo
  ocamlc -pp "camlp4r pa_extend.cmo q_MLast.cmo" \
          -I +camlp4 -c stdlibr.ml
  File "stdlibr.ml", line 20, characters 40-48:
  Unbound value Pcaml.sequence
  make: *** [stdlibr.cmo] Error 2

How are these parsers supposed to be used?

Thanks.
--Dan Bensen
www.prairienet.org/~dsb/



             reply	other threads:[~2007-07-09 14:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09 14:22 dsb [this message]
2007-07-10  9:27 ` [Caml-list] " Daniel de Rauglaudre
2007-07-10 13:18   ` Nicolas Pouillard

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=47259.192.17.3.107.1183990952.squirrel@mail.prairienet.org \
    --to=dsb@prairienet.org \
    --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).