Skip to content
fangel edited this page Jan 28, 2013 · 1 revision

RelAlg.js is built in a very classical manner. It consists of a lexer+parser section that reads in a input file and constructs an instance of a abstract syntax tree (AST). This tree is an instance of the Tree class found in lib/tree.js.

The lexer+parser is constructed from a grammar-file that is passed through Jison. The grammar file can be found in source/relalg.jison, and the generated lexer+parser can be found in lib/parser.js.

Once you have a AST you can pass it too the evaluate function found in lib/evaluate.js which will do try to evaluate the tree by doing recursively calling itself on each sub-node in the tree.

Clone this wiki locally