Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: P6: Beginning grammar

by moritz (Cardinal)
on Jun 08, 2010 at 06:47 UTC ( [id://843621]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %actions = 
       '*' => { $^a * $^b },
    ...
       '-' => { $^a - $^b };
    ...
    make %actions{$<op>.ast}.(|$/<lhs rhs>)
    
  2. or download this
    rule expression { <lhs=.numeric> <op> <rhs=.numeric> }
    
  3. or download this
    method numeric($/) { make +$/ }
    #                         ^  convert to a number
    ...
       }
       make $value;
    }
    
  4. or download this
    use v6;
    grammar Calc {
    ...
    say "$m<expression> =  $m.ast()";
    
    # vim: ft=perl6
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-23 11:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found