Parse::RPN

Parse::RPN is a minimalist RPN parser/processor (a little like FORTH).
Download

Parse::RPN Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Fabrice DULAUNOY
  • Publisher web site:
  • http://search.cpan.org/~fdulau/Tie-Hash-RegexKeys-1.2/RegexKeys.pm

Parse::RPN Tags


Parse::RPN Description

Parse::RPN is a minimalist RPN parser/processor (a little like FORTH). Parse::RPN is a minimalist RPN parser/processor (a little like FORTH).SYNOPSIS use Parse::RPN; $result=rpn(string ...); @results=rpn(string ...); $error=rpn_error();string... is a list of RPN operator and value separated by a coma in scalar mode RPN return the result of the calculation (If the stack contain more then one element, you receive a warning and the top value on the stack) in array mode, you receive the content of the stack after evaluationrpn() receive in entry a scalar of one or more elements coma separated and evaluate as an RPN (Reverse Polish Notation) command. The function split all elements and put in the stack. The operator are case sensitive. The operator are detect as is, if they are alone in the element of the stack. Extra space before or after are allowed (e.g "3,4,ADD" here ADD is an opeartor but it is not the case in "3,4,ADD 1") If element is not part of the predefined operator (dictionary), the element is push as a litteral.If you would like to put a string which is part of the dictionary, put it between quote or double-quote (e.g "3,4,'ADD'" here ADD is a literal and the evaluation reurn ADD and a warning because the stack is not empty) If the string contain a coma, you need also to quote or double-quote the string. (be care to close your quoted or double-quoted string)The evaluation follow the rule of RPN or FORTH or POSTCRIPT or pockect calcutor HP. Look on web for documentation about the use of RPN notation. I use this module in a application where the final user need to create an maintain a configuration file with the possibility to do calculation on variable returned from application. The idea of this module is comming from Math::RPN of Owen DeLong, owen@delong.com that I used for more then a year before some of my customer would like more ... I correct a bug (interversion of > and >=), add the STRING function, pattern search and some STACK functions.rpn_error() return the last error from the evaluation (illegal division by 0, error from the PERL function execution...) each time that rpn() is call the rpn_error() is reinitianised. Requirements: · Perl


Parse::RPN Related Software