AnaGram Parser Generator: Summary of Notation
Overview of notation used to specify a parser using AnaGram. Lexical conventions, symbol names, character sets, keywords, tokens, productions, grammar rules, etc.
Excerpt found on www.parsifalsoft.com
The rules for using AnaGram are given in Chapters 8 and 9 of the AnaGram User’s Guide. This page contains a brief summary. AnaGram’s online Help also has entries to explain the various terms. An example, a simple four-function calculator, with explanatory annotations can be viewed here. The annotated example and its syntax file are included with the AnaGram trial copy download.
AnaGram allows the free use of spaces, tabs and comments. Both C style and C++ style comments are allowed. Blank lines are allowed, but only between statements.
AnaGram statements may continue onto following lines as long as they are clearly incomplete. Normally this rule is satisfied by dangling punctuation or open parentheses, brackets, or braces. In no case can a statement continue over a blank line.
Symbol names must begin with a letter or underscore, and may contain letters, digits, or underscores. They may also contain embedded spaces, tabs, and comments. Any sequence of embedded space, however, is replaced by a single blank character.
You may represent a character using the same rules as for character constants in C. You may also use signed integers, using either decimal, octal or hexadecimal formats, again following the rules for C. You may specify control characters using ^, e.g., ^C.
A character string enclosed in double quotes, such as "while" or "/*", is a keyword. See example. The rules for writing keyword strings are the same as for literal strings in C. AnaGram parsers have special lookahead logic to recognize keywords, so that keywords get special treatment. They are not equivalent to the corresponding sequence of single characters.
