Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 pondering the Monastery: (7)
As of 2015-07-31 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls