Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IMCC grammar bug

2 views
Skip to first unread message

Dan Sugalski

unread,
May 7, 2004, 10:30:49 AM5/7/04
to perl6-i...@perl.org
Apparently it's not happy with things of the form

foo = bar * .95

where the RHS of the binary operation is a floating point constant
with no integer portion. Changing it to 0.95 works, so I assume the
grammar just needs a tweak.
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

Leopold Toetsch

unread,
May 7, 2004, 10:58:36 AM5/7/04
to Dan Sugalski, perl6-i...@perl.org
Dan Sugalski <d...@sidhe.org> wrote:
> Apparently it's not happy with things of the form

> foo = bar * .95

> where the RHS of the binary operation is a floating point constant
> with no integer portion. Changing it to 0.95 works, so I assume the
> grammar just needs a tweak.

Yep. The lexer (imcc.l) is missing this case.

Patches welcome,
leo

Dan Sugalski

unread,
May 7, 2004, 2:10:52 PM5/7/04
to l...@toetsch.at, perl6-i...@perl.org

It'd help if I could actually rebuild this so it could be tested...

This is the patch. It should work but the version of flex I have installed
doesn't play nice with the rest of the source, so I can't build and test.

--- imcc/imcc.l~ 2004-04-23 05:20:30.000000000 -0400
+++ imcc/imcc.l 2004-05-07 14:02:07.000000000 -0400
@@ -84,7 +84,7 @@
BIN 0b[01]+
DOT [.]
SIGN [-+]
-FLOATNUM {SIGN}?{DIGITS}{DOT}{DIGIT}*([eE]{SIGN}?{DIGITS})?
+FLOATNUM {SIGN}?({DIGITS}{DOT}{DIGIT}*|{DOT}{DIGITS})([eE]{SIGN}?{DIGITS})?
LETTERDIGIT [a-zA-Z0-9_]
LABELLETTERDIGIT ([a-zA-Z0-9_@]|"::")
ID {LETTER}{LABELLETTERDIGIT}*

Leopold Toetsch

unread,
May 7, 2004, 2:43:42 PM5/7/04
to Dan Sugalski, perl6-i...@perl.org
Dan Sugalski <d...@sidhe.org> wrote:

> It'd help if I could actually rebuild this so it could be tested...

Works. Applied. Tests ok. Thanks,
leo

0 new messages