rpn-infix-postfix

1.0.5 • Public • Published

RPN


Jan Łukasiewicz (Inventor of RPN)

Infix to postfix

Reverse Polish notation (RPN), also known as Polish postfix notation or simply postfix notation, is a mathematical notation in which operators follow their operands, in contrast to Polish notation (PN), in which operators precede their operands. It does not need any parentheses as long as each operator has a fixed number of operands. The description "Polish" refers to the nationality of logician Jan Łukasiewicz, who invented Polish notation in 1924     -Wikipedia


Npm

Downloading

$npm i rpn-infix-postfix

Usage

const {  
  infixToPostfix,
  postfixSolver,
  solve,
  Stack }  = require('rpn-infix-postfix');
 
console.log(solve('1 + 2 * 9' )); // result => 19
console.log(
  infixToPostfix('1*(4-2)', new Stack(100)).join('')
); // result => 142-*

Downloading (via git)

git clone https://github.com/SC0d3r/RPN-infix-to-postfix.git RPN

cli Usage

after cloning go to directory and then run the following command

$node index.js '1* ( 2 + 3)'
 
    > 5 [result]

only postfix version

$node index.js '1* ( 2 + 3)' -postfix
 
   > 123+* [result]

Test

run tests with

$npm test

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.52latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.52
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i rpn-infix-postfix

Weekly Downloads

1

Version

1.0.5

License

MIT

Last publish

Collaborators

  • sc0d3r