module languages.antlr_grammar_build
¶
Short summary¶
module pyensae.languages.antlr_grammar_build
Helpers to build grammars This module requires antlr4. and antlr4-python3-runtime.
Functions¶
function |
truncated documentation |
---|---|
Downloads the grammar for a specific language if the files is missing. |
|
Compiles the grammar for a specific file. |
Documentation¶
Helpers to build grammars This module requires antlr4. and antlr4-python3-runtime.
- pyensae.languages.antlr_grammar_build._is_syntax_is_missing(language)¶
Downloads the grammar for a specific language if the files is missing.
- Parameters:
language – language: python, sqlite, …
- Returns:
grammar file
- pyensae.languages.antlr_grammar_build.build_grammar(g4, version='4.10.1', fLOG=<function noLOG>)¶
Compiles the grammar for a specific file.
- Parameters:
g4 – grammar format antlr4
version – version of antlr4 to use, 4.9
fLOG – logging function
- Returns:
list of files
The compilation must be done with antlr4. It generates a lexer and a parser which can be imported in Python. The options for the command line are described at: antlr4 options.