Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Top down operator parsing (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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: