Greetings,

On Sun Mar 11 08:03:06 2007, kjs wrote:
> Currently, S, N, I and P registers are limited to 2 digits; that is, you 
> can only use:
> 
> [S|N|I|P]0 to [S|N|I|P]99.
> 
> For instance, this fails:
> 
> .sub main
>   P333 = new .Integer
>   P333 = 1
> .end
> 
> Since Parrot does not have a limit of 32 registers per type anymore, 
> this is a bug, according to Coke:
> 
> [15:34] <kjs> it's limited to 2 digits
> [15:35] <@cognominal> kjs: probably a linitation in the lexer :)
> [15:35] <@Coke> that's a bug, SFAIK.
> 
> 
> If this is indeed a bug, I think it should be easy to fix (as mentioned, 
> probably an IMCC limitation).

The attached patch changes the lexer to accept [S|N|I|P][0-9]+, note
that the patch also changes compilers/imcc/imclexer.c, because it's
necessary to generate a new lexer.

With this lexer:
$ cat test.pir 
.sub main :main
   P111 = new Integer
   P111 = 1
   print P111
.end
$ ./parrot test.pir 
1

I've run the tests and didn't find any test failling because of this
change. With this change we can have "P99999999999..999", if a limit to
the number of digits (or size) in the register name is defined i can
change the lexer to accept only names inside the limit. 

More testing is welcome.
 
> regards,
> kjs
Best regards,
./smash


Reply via email to