Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 romping around the Monastery: (5)
As of 2014-09-02 07:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (20 votes), past polls