in reply to Parse::RecDescent grammar and Parenthesis

hmmm...have you tried adding a second rule for print_instruction that has the optional parens? not the most elegant solution, but it seems like it should work.
print_instruction : /print/i expression { use Data::Dumper; print Dumper \%item; print $item{expression}."\n" } | /print/i '(' expression ')' { use Data::Dumper; print Dumper \%item; print $item{expression}."\n" }
HTH

/\/\averick
perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"

Replies are listed 'Best First'.
(crazyinsomniac) Re^2: Parse::RecDescent grammar and Parenthesis
by crazyinsomniac (Prior) on Dec 17, 2001 at 13:54 UTC
    Yes I have, but it behaves the same as before (it will print a straight number, but not an expression).

    My original modifications look like they should work also, but sadly that is not the case ;(

    update:

    Upon the suggestion of jmcnamara i've set $::RD_TRACE = 1; and ran the beast and got the following in my STDERR (readmore follows)

     
    ___crazyinsomniac_______________________________________
    Disclaimer: Don't blame. It came from inside the void

    perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"