A racket language for PEGs with types and stack. This implementation extends the PEG language to encompass stack operations, as in the PEST parsers. In addition to these operations we also include two new operations that allow to access the top of the stack and use these values in simple computations. The new operations are checked by the type-system to assure no operations can loop.
In order to type check, the tool need a working installation of Z3 SMT Solver. The project is known to work with Z3 version 4.8.14.
Following the racket approach to build small languages, we have build some auxiliar languages to ease the task of use/debug the tool.
#lang typed-peg
: default language, provides a parse and pretty printing function for the specified PEG, after infering types for the input PEG.#lang typed-peg-stack/untyped
: disable the type-inference engine. Use at your own risk!#lang typed-peg-stack/debug/tokenize-only
: outputs the result of the lexical analyser.#lang typed-peg-stack/debug/parse-only
: outputs the result of the parser.#lang typed-peg-stack/debug/constraints-only
: outputs the constraints generated by the algorithm.#lang typed-peg-stack/debug/z3-script-only
: outputs the z3 script that encode the constraints.#lang typed-peg-stack/debug/infer-only
: outputs the infered types for each grammar non-terminal.