You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4006 Reporter: Pasinelli Status: confirmed (set by @damiendoligez on 2012-04-10T15:48:01Z) Resolution: open Priority: normal Severity: feature Version: 3.09.2 Category: documentation Monitored by: ertai
Bug description
I put here this message for I wasted hours in understandig why my code did not work. This is due to a lack of information provided in Camlp4's Reference Manual and Tutorial, although these ones are generally speaking very usefull.
The INT and FLOAT statements only work with positive numbers : this might be trivial if you have a look to Camlp4's source code, but it is not "natural" at all.
I have put down a whole session under Solaris 9, running the 3.06 version, but it is reproductible with any version up to 3.09, I guess, for the source code I examined was the one of the 3.09 version.
ocaml
Objective Caml version 3.06
#load "camlp4o.cma";;
Camlp4 Parsing version 3.06
#load "pa_extend.cmo";;
let gram = Grammar.gcreate (Plexer.gmake ());;
val gram : Grammar.g =
let flottant = Grammar.Entry.create gram "flottant";;
val flottant : '_a Grammar.Entry.e =
let entier = Grammar.Entry.create gram "entier";;
val entier : '_a Grammar.Entry.e =
EXTEND
flottant :
[
[ z = FLOAT -> print_endline z ]
]
;
entier :
[
[ e = INT -> print_endline e ]
]
;
END
;;
: unit = ()
let apply_flottant s = Grammar.Entry.parse flottant (Stream.of_string s);;
val apply_flottant : string -> unit =
let apply_entier s = Grammar.Entry.parse entier (Stream.of_string s);;
val apply_entier : string -> unit =
apply_flottant "-3.5676876";;
Exception:
Stdpp.Exc_located ((0, 1), Stream.Error "illegal begin of flottant").
apply_entier "-586689";;
Exception:
Stdpp.Exc_located ((0, 1), Stream.Error "illegal begin of entier").
apply_flottant "8.7697";;
8.7697
: unit = ()
apply_entier "65765";;
65765
: unit = ()
#quit;;
Additional information
When you have -3.5676876 there is two tokens, that's all.
The camlp4 doc needs an update but that's not the topic here.
The text was updated successfully, but these errors were encountered:
Before I put the issue here, I sent en e-mail to the OCaml team. I had no answer at all and that is why I decided to create an issue here in order to warn people who had experienced the same trouble.
I am not saying it is a bug; I am not saying it is an error either, just an odd feature that I think would deserve to be documented.
When I posted the message, I saw the "OCaml documentation" item in the list of categories in which to create the issue, so I thought it REALLY was the right place.
Excuse my ignorance in knowing how to interpret english statements.
Original bug ID: 4006
Reporter: Pasinelli
Status: confirmed (set by @damiendoligez on 2012-04-10T15:48:01Z)
Resolution: open
Priority: normal
Severity: feature
Version: 3.09.2
Category: documentation
Monitored by: ertai
Bug description
I put here this message for I wasted hours in understandig why my code did not work. This is due to a lack of information provided in Camlp4's Reference Manual and Tutorial, although these ones are generally speaking very usefull.
The INT and FLOAT statements only work with positive numbers : this might be trivial if you have a look to Camlp4's source code, but it is not "natural" at all.
I have put down a whole session under Solaris 9, running the 3.06 version, but it is reproductible with any version up to 3.09, I guess, for the source code I examined was the one of the 3.09 version.
#load "camlp4o.cma";;
#load "pa_extend.cmo";;
let gram = Grammar.gcreate (Plexer.gmake ());;
val gram : Grammar.g =
let flottant = Grammar.Entry.create gram "flottant";;
val flottant : '_a Grammar.Entry.e =
let entier = Grammar.Entry.create gram "entier";;
val entier : '_a Grammar.Entry.e =
EXTEND
END
;;
let apply_flottant s = Grammar.Entry.parse flottant (Stream.of_string s);;
val apply_flottant : string -> unit =
let apply_entier s = Grammar.Entry.parse entier (Stream.of_string s);;
val apply_entier : string -> unit =
apply_flottant "-3.5676876";;
Exception:
Stdpp.Exc_located ((0, 1), Stream.Error "illegal begin of flottant").
apply_entier "-586689";;
Exception:
Stdpp.Exc_located ((0, 1), Stream.Error "illegal begin of entier").
apply_flottant "8.7697";;
8.7697
apply_entier "65765";;
65765
#quit;;
Additional information
When you have -3.5676876 there is two tokens, that's all.
The camlp4 doc needs an update but that's not the topic here.
The text was updated successfully, but these errors were encountered: