Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004006OCamlOCaml documentationpublic2006-04-16 20:582012-07-12 11:25
ReporterPasinelli 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version3.09.2 
Target VersionFixed in Version 
Summary0004006: Camlp4's default lexer fails on negative numbers
DescriptionI 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 = <abstr>
# let flottant = Grammar.Entry.create gram "flottant";;
val flottant : '_a Grammar.Entry.e = <abstr>
# let entier = Grammar.Entry.create gram "entier";;
val entier : '_a Grammar.Entry.e = <abstr>
# 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 = <fun>
# let apply_entier s = Grammar.Entry.parse entier (Stream.of_string s);;
val apply_entier : string -> unit = <fun>
# 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 InformationWhen you have -3.5676876 there is two tokens, that's all.
The camlp4 doc needs an update but that's not the topic here.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0003762)
Pasinelli (reporter)
2006-09-05 20:25

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.
(0007313)
doligez (administrator)
2012-04-10 17:48

We need to make sure that the documentation explains the behaviour clearly and correctly.

- Issue History
Date Modified Username Field Change
2006-04-16 20:58 Pasinelli New Issue
2006-08-29 17:51 doligez Assigned To => ertai
2006-08-29 17:51 doligez Status new => acknowledged
2006-09-05 13:38 ertai Status acknowledged => closed
2006-09-05 13:38 ertai Resolution open => no change required
2006-09-05 13:38 ertai Additional Information Updated
2006-09-05 20:25 Pasinelli Status closed => feedback
2006-09-05 20:25 Pasinelli Resolution no change required => reopened
2006-09-05 20:25 Pasinelli Note Added: 0003762
2012-04-10 17:48 doligez Note Added: 0007313
2012-04-10 17:48 doligez Status feedback => confirmed
2012-04-10 17:48 doligez Resolution reopened => open
2012-07-12 11:25 doligez Assigned To ertai =>


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker