PurposeThis library makes it possible to rapidly assemble and deploy a parser for a simple language. It is intended primarily for languages that have an LL grammar.
UsageThe library can be included in a webpage in the usual way:
The above introduces the
imparse object into scope. To obtain a JSON representation of an abstract syntax tree given a grammar definition
grammar (in JSON format) and a concrete syntax string
str, it is sufficient to call
Below are a few interactive examples of how the library can be used to define a grammar and parse a concrete syntax string into a JSON representation of an abstract syntax tree. You can change the grammar or input string and see the results immediately.
The example below is based on the language specified in Genetic Design via Combinatorial Constraint Specification by Bhatia et al. Note that the then operator has lowest precedence, the and and or operators are right-associative, and the unary operators have highest precedence.
The development of this library is partially supported by the National Science Foundation under Grants #1012060, #1239021, and #1718135. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
Collaborators who have contributed to the design and/or implementation of this library include Weston Vial, Eric Dunton, and Vidhu Nath.