* sequence parser, revised syntax @ 2007-07-09 14:22 dsb 2007-07-10 9:27 ` [Caml-list] " Daniel de Rauglaudre 0 siblings, 1 reply; 3+ messages in thread From: dsb @ 2007-07-09 14:22 UTC (permalink / raw) To: caml-list 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/ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] sequence parser, revised syntax 2007-07-09 14:22 sequence parser, revised syntax dsb @ 2007-07-10 9:27 ` Daniel de Rauglaudre 2007-07-10 13:18 ` Nicolas Pouillard 0 siblings, 1 reply; 3+ messages in thread From: Daniel de Rauglaudre @ 2007-07-10 9:27 UTC (permalink / raw) To: caml-list Hi, On Mon, Jul 09, 2007 at 09:22:32AM -0500, dsb@prairienet.org wrote: > $ 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 Some of the grammar sub-entries used in the files defining the syntax (e.g. "sequence") are indeed not accessible in the Pcaml module. The problem is that there are many of them, many small entries useful only in specifics parts of the grammar. These small entries may change, appear, disappear, from a version of camlp4 to another when new things are added in the language syntax, or to fix possible bugs. It is often difficult to "standardize" them. Moreover, some of these entries may be used in revised syntax and not in normal syntax and vice-versa, or have a different type and semantics. The solution is to rewrite, yourself, the missing entry in your sources. You can see how "sequence" is implemented in the revised syntax and copy it (it is short). Perhaps the function Grammar.Entry.print should show differently the "accessible" entries and the "non accessible" ones. I am going to see if it is possible to implement that. -- Daniel de Rauglaudre http://pauillac.inria.fr/~ddr/ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] sequence parser, revised syntax 2007-07-10 9:27 ` [Caml-list] " Daniel de Rauglaudre @ 2007-07-10 13:18 ` Nicolas Pouillard 0 siblings, 0 replies; 3+ messages in thread From: Nicolas Pouillard @ 2007-07-10 13:18 UTC (permalink / raw) To: dsb, Daniel de Rauglaudre; +Cc: caml-list On 7/10/07, Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr> wrote: > Hi, Hi, > > On Mon, Jul 09, 2007 at 09:22:32AM -0500, dsb@prairienet.org wrote: > > > $ 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 FYI in ocaml 3.10... > Some of the grammar sub-entries used in the files defining the syntax > (e.g. "sequence") are indeed not accessible in the Pcaml module. In 3.10 sequence is exported (so extensible). > The problem is that there are many of them, many small entries useful > only in specifics parts of the grammar. In 3.10 most of them are exported. > These small entries may change, appear, disappear, from a version of > camlp4 to another when new things are added in the language syntax, or > to fix possible bugs. It is often difficult to "standardize" them. Even if it's difficult we tend to reach a stability point and then prefer expose these things. > Moreover, some of these entries may be used in revised syntax and not > in normal syntax and vice-versa, or have a different type and semantics. In 3.10 both syntaxes share a common grammar (the revised one), therefore there are closer in types and semantics. Cheers, -- Nicolas Pouillard ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-10 13:18 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-07-09 14:22 sequence parser, revised syntax dsb 2007-07-10 9:27 ` [Caml-list] " Daniel de Rauglaudre 2007-07-10 13:18 ` Nicolas Pouillard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox