Validating and non validating parser

However, ANTLR does not create lexer rules to match the strings.

Instead, ANTLR enters the strings into a literals table in the associated lexer.

The characters in the string may be represented using the same escapes (octal, Unicode, etc.) that are valid in character literals.

Enclosing curly braces are not used to delimit the class because it is hard to associate the trailing right curly brace at the bottom of a file with the left curly brace at the top of the file.

Instead, a parser class is assumed to continue until the next A parser class results in parser objects that know how to apply the associated grammatical structure to an input stream of tokens.

The subsequent characters may be any letter, digit, or underscore. Curly braces within string and character literals are not action delimiters. Character sequences in (possibly nested) square brackets are rule argument actions.

Square braces within string and character literals are not action delimiters.

For example, the literal "return" will have an associated value of LITERAL_return.

You may also assign a specific label to a literal using the tokens section. Identifiers beginning with an uppercase letter are token references.

A parser class specification precedes the options and rule definitions of the parser.

A parser specification in a grammar file often looks like: s, and some name-mangling would be used to make the resulting rule functions globally unique.

A token reference in a lexer rule results in a call to the lexer rule for matching the characters of the token.

Tags: , ,