in reply to Re: S-expressions with Marpa::R2: Grammar for Numbers
in thread S-expressions with Marpa::R2: Grammar for Numbers

Or, if you want to support the exponential notation, too:
number ~ sign_maybe digit_many e | sign_maybe digit_any '.' digit_many e_maybe | sign_maybe digit_many e_maybe | sign_maybe non_zero digit_any empty ~ sign_maybe ~ [+-] | empty digit ~ [0-9] non_zero ~ [1-9] digit_any ~ digit* digit_many ~ digit+ e ~ [Ee] sign_maybe digit_many e_maybe ~ e | empty

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^3: S-expressions with Marpa::R2: Grammar for Numbers
by Fletch (Bishop) on Dec 23, 2025 at 15:41 UTC