// define operators here
// arguments: name, priority (>0), associativity ('left', 'right')
operator('+', 1, 'left');
operator('^', 3, 'left');
operator('-', 1, 'left');
operator('*', 2, 'left');
operator('/', 2, 'left');
operator('**', 3, 'right');
eparse> 2+2*2**2**2*2+2
tokens: [number(2), op(+), number(2), op(*), number(2), op(**), number
(2), op(**), number(2), op(*), number(2), op(+), number(2)]
result: [[2 + [[2 * [2 ** [2 ** 2]]] * 2]] + 2]
Its parser is about 200 lines.
https://github.com/nishio/Parser-on-browser
See guide.rst for a high-level guide of the code.
GPLv3 (c) NISHIO Hirokazu 2012
Paweł Marczewski contributed much to the project.