sq/grammar
2020-08-06 11:58:47 -06:00
..
grun codebase refactor 2020-08-06 11:58:47 -06:00
README.md codebase refactor 2020-08-06 11:58:47 -06:00
SLQ.g4 codebase refactor 2020-08-06 11:58:47 -06:00

SLQ Grammar

The query language used by SQ is formally known as SLQ. The grammar is defined in SLQ.g4, which is an ANTLR4 grammar.

The antlr4 tool generates the parser / lexer files from the grammar. Being that antlr4 is Java-based, Java must be installed to regenerate from the grammar. This process is encapsulated in a mage target:

# from SQ_PROJ_ROOT
mage generateparser

The generated .go files ultimately end up in package libsq/slq. Files in this directory should not be directly edited. The libsq/ast.Parse function takes a SLQ input string and returns an *ast.AST. It is the libsq.ExecuteSLQ function that invokes ast.Parse.