Описание тега grako
Grako (for grammar compiler) is a tool that takes grammars in a variation of EBNF as input, and outputs memoizing (Packrat) PEG parsers in Python.
Grako (for grammar compiler) is a tool that takes grammars in a variation of EBNF as input, and outputs memoizing (Packrat) PEG parsers in Python.
Features:
Generated parsers use Python's exception-handling system to backtrack.
Positive and negative lookaheads, and the cut element allow for hand-crafted optimizations at the grammar level.
Delegation to Python's
re
module for lexemes allows for Perl-like lexical analysis.Python's context managers reduce the size of the generated parsers.
Include files, rule inheritance, and rule inclusion provide expressive power
Support for direct and indirect left recursion allows more intuitive grammars.
See also
python ply yacc bison antlr jison happy ml-yacc ocamlyacc menhir fsyacc sablecc cup