View Source Grammar.CodeGen (Grammar v0.4.0)

This module exposes functions required to generate the code for the parser derived from grammar rules.

It uses Clause struct to store the definition of clauses. Clauses sharing the same name are considered as clauses of a single rule.

Summary

Functions

Produces the quoted expression of the code that builds the grammar from the stored clauses.

Produces the list of quoted expressions of callback functions, on for each clause.

Produces the quoted expression of the code that stores a clause definition in the current module.

Functions

Link to this function

build_grammar(module, clauses)

View Source

Produces the quoted expression of the code that builds the grammar from the stored clauses.

Link to this function

build_rule_body_functions(rules)

View Source

Produces the list of quoted expressions of callback functions, on for each clause.

Link to this function

store_clause(rule_name, meta, def, blk, epsilon)

View Source

Produces the quoted expression of the code that stores a clause definition in the current module.