Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: P6: Beginning grammar

by moritz (Cardinal)
on Jun 08, 2010 at 06:47 UTC ( #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
Node Status?
node history
Node Type: note [id://843621]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-07-30 21:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (241 votes), past polls