Browse thread
camlp5 parsing question
- Aaron Bohannon
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2009-10-14 (15:27) |
From: | Aaron Bohannon <bohannon@c...> |
Subject: | camlp5 parsing question |
I don't understand why I am getting certain parse errors after extending a grammar. For instance, if I extend the original OCaml grammar with these rules-- expr: LEVEL "simple" [ [ "`"; "+"; "-" -> <:expr< 1 >> ] | [ "`"; "+"; "*" -> <:expr< 2 >> ] ]; --then when I try out the syntax, I get: # ` + - ;; - : int = 1 # ` + * ;; Toplevel input: # ` + * ;; ^^^ Parse error: '+' '-' expected after '`' (in [expr]) If the grammar is being left-factored according to the description in the documentation (sec. 3.4 of http://pauillac.inria.fr/~ddr/camlp5/doc/htmlc/grammars.html), I don't see why these two rules should get in each other's way. Moreover, the base grammar defined in "pa_o.ml" seems to use rules with similarly overlapping initial parts without any trouble. - Aaron