3 ms·
Top down operator parsing (http://javascript.crockford.com/tdop/tdop.html http://javascript.crockford.com/tdop/tdop.html) is pretty easy to implement, is inhere
by breuleux 13y ago
Top down operator parsing (http://javascript.crockford.com/tdop/tdop.html http://javascript.crockford.com/tdop/tdop.html) is pretty easy to implement, is inherently efficient, and trivial to extend.
Even that might be overkill, though: a generic operator parser for unary, binary, ternary, n-ary, and so on will take about 50 lines of code. You can encode a surprisingly large number of control structures with a cleverly crafted precedence parser.