Skip to content

Parse and execute polish notation expression with javascript

Notifications You must be signed in to change notification settings

altitude/libprefix.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Libprefix.js

This library allows you to parse and run polish notation expression with javascript.

var libprefix = require('./libprefix-node.js');
libprefix.process("(and 1 1 (or 1 0))", {}, libprefix.operators); // returns 1

If you like, you can pass a context to the function to use variables in your expression

var context = {a:1, b:0, c:1}
libprefix.process("(and a b (and a c 1))", context, libprefix.operators); // returns 0

Simple boolean logic operators are implemented, but you can override them if you like. You can even create your own operators with simple javascript functions.

About

Parse and execute polish notation expression with javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages