An important feature of Anzo on the Web is the ability to specify custom equations, similar to the ones you see in Excel, to do various analytics.  The language is similar to what you see in Excel, except the values are specified by RDF paths, rather than regions.  The editor has the formula editing region at the top, a place to select value fields on the bottom-left and a function selector on the bottom-right:


For fast validation of formulas, I needed to build a parser for the language that would run in the browser (in javascript).  To do so, I used the awesome LALR(1) parser and lexical analyzer generator for JavaScript, which is itself written in javascript.

The installed version can be found here: JS/CC

To create a parser, you need to tell it about the language you want to parse.  You do this using aBackus-Naur-Form-based meta language , and it generates the javascript parser for you!  A good way to get started is to study the Calculator example, which can be loaded by clicking on the dropdown at the top, selecting it and clicking the ‘load’ button.