There's more than one way to do things | |
PerlMonks |
Re: First steps with Marpa::R2 and BNFby choroba (Cardinal) |
on Jan 13, 2021 at 14:56 UTC ( [id://11126848]=note: print w/replies, xml ) | Need Help?? |
Before reaching for Marpa, make sure you need it. Is the language you're trying to recognise more complex than regular? See Chomsky hierarchy for explanation. If it's regular, regular expressions should do just well. Using a context-free grammar is an overkill. I don't know what combinations are possible, but I have a feeling there's no nesting involved which would mean you don't need to go context-free.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Seekers of Perl Wisdom
|
|