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}