Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Operator Precedence Parser

by bart (Canon)
on Jun 09, 2006 at 15:39 UTC ( #554516=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    expr := value ( op value )*
    
  2. or download this
    sub parse_expr {
        my($value, @stack);
    ...
        $value = process(\@stack, $value);  # final processing
        return $value;
    }
    
  3. or download this
    value := '(' expr ')'
    
  4. or download this
    #!perl -w
    use strict;
    ...
    $_ = "20+3*a+10*-b-5*(3 +2)*5";
    $\ = "\n";
    print evaluate($_);
    
  5. or download this
    #!perl -w
    use strict;
    ...
    $_ = "20+3*a+10*-b-5*(3 +2)*5";
    $\ = "\n";
    print evaluate($_);
    
  6. or download this
    value := name '(' ( expr ( ',' expr ) * )? ')'
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://554516]
Approved by Limbic~Region
Front-paged by liverpole
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-07-28 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (209 votes), past polls