| Anonymous | Login | Signup for a new account | 2013-05-25 06:14 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0004330 | OCaml | Camlp4 | public | 2007-06-25 13:31 | 2008-10-03 17:13 | |||
| Reporter | brunodefraine | |||||||
| Assigned To | ertai | |||||||
| Priority | normal | Severity | major | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.10.0 | |||||||
| Target Version | Fixed in Version | 3.11+dev | ||||||
| Summary | 0004330: gramlib parses illegal input for recursive rules | |||||||
| Description | When defining a recursive rule for a binary operator, gramlib accepts input that illegally ommits a right operand. For example, with the following grammar definition: open Camlp4.PreCast ; value a = Gram.Entry.mk "a" ; value a_eoi = Gram.Entry.mk "a_eoi" ; EXTEND Gram a: [[ "one" -> 1 | x = a; "plus"; y = a -> x+y ]]; a_eoi: [[ x = a; `EOI -> x ]]; END ; and the following function: value parse_string entry s = try Gram.parse_string entry (Loc.mk "<string>") s with [ Loc.Exc_located loc exn -> begin print_endline (Loc.to_string loc); print_endline (Printexc.to_string exn); failwith "Syntax Error" end ] ; The following is correct: # parse_string a_eoi "one plus one" ; - : int = 2 While all of the following inputs should be rejected because they are not legal according to the grammar: # parse_string a_eoi "one plus" ; - : int = 1 # parse_string a_eoi "one plus plus" ; - : int = 1 # parse_string a_eoi "one plus one plus" ; - : int = 2 # parse_string a_eoi "one plus one plus plus" ; - : int = 2 Curiously, you may only repeat the operator twice. If you specify it three times, gramlib complains. # parse_string a_eoi "one plus plus plus" ; File "<string>", line 1, characters 9-13 Stream.Error("EOI expected after [a] (in [a_eoi])") Exception: Failure "Syntax Error". # parse_string a_eoi "one plus one plus plus plus" ; File "<string>", line 1, characters 18-22 Stream.Error("EOI expected after [a] (in [a_eoi])") Exception: Failure "Syntax Error". | |||||||
| Additional Information | Tested with Ocaml 3.10.0 on Mac OS X. | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0004652) ertai (developer) 2008-10-03 17:13 |
Thank for the report(s) this bug is now fixed in the CVS HEAD version. NOTE: PR#4603, PR#4330, PR#4551, PR#4513 are all the same bug. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2007-06-25 13:31 | brunodefraine | New Issue | |
| 2007-06-25 13:31 | brunodefraine | File Added: gram_rec.ml | |
| 2007-11-10 15:03 | xleroy | Status | new => assigned |
| 2007-11-10 15:03 | xleroy | Assigned To | => ertai |
| 2008-10-03 17:13 | ertai | Note Added: 0004652 | |
| 2008-10-03 17:13 | ertai | Status | assigned => closed |
| 2008-10-03 17:13 | ertai | Resolution | open => fixed |
| 2008-10-03 17:13 | ertai | Fixed in Version | => 3.11+dev |
| Copyright © 2000 - 2011 MantisBT Group |