Not Quite Perl Not Quite Perl - A lightweight Perl 6 #28

<dec_number> from HLL::Grammar

To enable fractional values, change

token term:sym<value>    { <integer> }
...
method term:sym<value>($/) {
    make $<integer>.ast;
}

to

token term:sym<value>    { <dec_number> | <integer> }
...
method term:sym<value>($/) {
    make $<dec_number> ?? $<dec_number>.ast !! $<integer>.ast;
}
Copyright © 2010
http://www.pmichaud.com/2010/pres/