Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: First steps with Marpa::R2 and BNF

by choroba (Cardinal)
on Jan 13, 2021 at 14:56 UTC ( [id://11126848]=note: print w/replies, xml ) Need Help??


in reply to First steps with Marpa::R2 and BNF

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]

Replies are listed 'Best First'.
Re^2: First steps with Marpa::R2 and BNF
by Discipulus (Canon) on Jan 14, 2021 at 08:41 UTC
    Dear choroba,

    I consider you a friend, but your reply made my laugh :)

    let's rephrase it:

    > Q: Hey I need some help on the usage of my new electronic drill because its instruction contains too much theory..

    > A: Go study quantum mechanics to see if you can use a hammer instead

    I looked at the document you linked but I must confess I dont understand nothing of this. I'll bookmark it anyway and maybe one of my friends (a math professor) some day can explain me its meaning.

    About overkill tecniques: I dont use a batch file to check hosts in my network because perl is an overkill for such a simple task. I'd use perl because I'm better at this and it is fun!

    So I'd like to learn Marpa::R2 and BNF using this dice simultation as playground even if it can be accomplished with easy using simpler techniques (and wait: I have already done it ;) beacause the creativity is feeded by wider horizons if you know many different ways to approach the same problem.

    That said thanks for the example you linked in the chat and that I have put at the top of my program as reminders.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11126848]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2024-04-19 12:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found