Book a Demo
Prev Next

Grammar Instructions

Instructions specify the key details of how the grammar works. They are generally included at the top of the grammar, and resemble function calls in most programming languages.





One of these two instructions is expected to specify if token matching needs to be case sensitive or not. For example, languages in the BASIC family are case insensitive while languages in the C family are case sensitive.


delimiters(DelimiterRule: Expression)

The delimiters instruction tells the lexical analyzer which rule to use for delimiter discovery. Delimiters are used during keyword analysis, and can be defined as the characters that can be used immediately before or after language keywords.

lex(TokenRule: Expression)

The lex instruction tells the lexical analyzer the name of the root rule to use for its analysis.

parse(RootRule: Expression)
parse(RootRule: Expression, SkipRule: Expression)

The parse instruction tells the parser the name of the root rule to use for its processing. The optional second argument specifies a skip (or escape) rule, which is generally used to handle comments.

Learn more