Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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?
[LanX]: I told you the story about the “new" currency trading system of Dresdner Bank
[LanX]: ?
[Corion]: No, or I don't remember the story ;)
LanX my favourite don't tell me the proof of concept is good enough for production anecdote
[ambrus]: ah, it's one of thos
[Eily]: what, there's a difference between proof of concept and production?
[LanX]: 20 years ago traders were complaining about the latency of the trading system...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2017-03-29 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (348 votes). Check out past polls.