Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Can I get some rules help with PARSE::RECDESCENT

by beartham (Novice)
on Mar 10, 2018 at 19:55 UTC ( [id://1210633]=note: print w/replies, xml ) Need Help??


in reply to Can I get some rules help with PARSE::RECDESCENT

It has been about 18 years since I used RecDescent, but looking at your grammar, it seems that the array reference is coming from the '@' in the Action of your expr rule coupled with the brackets in your term rule, which seems to be misplaced with the leading '|', so its regex may not be recognized as a regex, confusing RecDescent. What is the '|' supposed to be an alternative of, the operand rule parenthesized expression?

I liked RecDescent for its EBNF, because I had much previous experience with another recursive descent metacompiler, TREE META, but I found it far too slow for my design work. I ended up using Bison. I wonder if Damien has improved its speed by re-coding some of it in C since I last used it. I wish I had more time to work on it.

  • Comment on Re: Can I get some rules help with PARSE::RECDESCENT

Replies are listed 'Best First'.
Re^2: Can I get some rules help with PARSE::RECDESCENT
by 7stud (Deacon) on Mar 10, 2018 at 20:16 UTC

    What is the '|' supposed to be an alternative of, the operand rule parenthesized expression?

    A rule can have alternatives, e.g. rule_name: alt1 | alt2, and you can insert an action in the middle of a rule:

    rule_name: alt1 {action} | alt2

    And, you can add whatever whitespace you want:

    rule_name: alt1 {action} | alt2

    And you can add an action at the end of a rule:

    rule_name: alt1 {action} | alt2 {action}

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (1)
As of 2024-04-25 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found