1Infix2Postfix(3) User Contributed Perl Documentation Infix2Postfix(3)
2
3
4
6 Affix::Infix2Postfix - Perl extension for converting from infix
7 notation to postfix notation.
8
10 use Affix::Infix2Postfix;
11
12 $inst=Affix::Infix2Postfix->new(
13 'ops'=>[
14 {op=>'+'},
15 {op=>'-'},
16 {op=>'*'},
17 {op=>'/'},
18 {op=>'-',type=>'unary',trans=>'u-'},
19 {op=>'func',type=>'unary'},
20 ],
21 'grouping'=>[qw( \( \) )],
22 'func'=>[qw( sin cos exp log )],
23 'vars'=>[qw( x y z)]
24 );
25 $rc=$inst->translate($str)
26 || die "Error in '$str': ".$inst->{ERRSTR}."\n";
27
29 Infix2Postfix as the name suggests converts from infix to postfix
30 notation. The reason why someone would like to do this is that postfix
31 notation is generally much easier to do in computers. For example take
32 an expression like: a+b+c*d. For us humans it's pretty easy to do that
33 calculation. But it's actually much better for computers to get a
34 string of operations such as: a b + c d * +, where the variable names
35 mean put variable on stack.
36
38 addi@umich.edu
39
41 perl(1).
42
43
44
45perl v5.36.0 2022-07-22 Infix2Postfix(3)