Singleton class encapsulating the grammar for the CellAtom language. More...
#include <parser.hh>
Static Public Member Functions | |
static const CellAtomGrammar & | get () |
Returns a singleton instance of this grammar. | |
Public Attributes | |
Rule | whitespace = ' '_E | '\t' | nl('\n') |
Whitespace: spaces, tabs, newlines. | |
Rule | comment |
Comments, including tracking newlines inside comments via the whitespace rule. More... | |
Rule | ignored = *(comment | whitespace) |
Rule for treating both comments and whitespace as ignored tokens. | |
Rule | digit = '0'_E - '9' |
Decimal digits. | |
Rule | literal = +digit |
Literal values are one or more digits. | |
Rule | v_reg = 'v'_E |
The current-value register v . | |
Rule | local_reg = 'a' >> digit |
Local registers, l0 to l9 . | |
Rule | global_reg = 'g' >> digit |
Global registers, g0 to g9 . | |
Rule | reg = v_reg | local_reg | global_reg |
Any register. | |
Rule | op = '+'_E | '=' |'-' | '*' | '/' | "min" | "max" |
Operation keywords. | |
Rule | arithmetic = op >> reg >> expression |
Arithmetic statements are an operation, a target register, and an expression. | |
Rule | neighbours = "neighbours"_E >> '(' >> statements >> ')' |
Neighbours expressions are simple a keyword and then a statement list in brackets. | |
Rule | range = literal | ('('_E >> literal >> ',' >> literal >> ')') |
The range part of a range expression (either a single value or an inclusive range). | |
Rule | range_expr = range >> "=>" >> expression |
A single entry in a range map: the source range and the target expression. | |
Rule | range_map |
A range map, evaluating to a different expression depending on the value in the register argument. More... | |
Rule | expression = literal | reg | range_map |
Valid expressions in this language are. | |
Rule | statement = neighbours | arithmetic |
Valid statements in this language are the arithmetic statements or neighbours statements. | |
Rule | statements = *statement |
List of zero or more statements. | |
Singleton class encapsulating the grammar for the CellAtom language.
Rule Parser::CellAtomGrammar::comment |
Rule Parser::CellAtomGrammar::range_map |
A range map, evaluating to a different expression depending on the value in the register argument.