...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
See here for more information about Nonterminals
.
Notation
RT
Synthesized attribute. The rule or grammar's return type.
Arg1
, Arg2
, ArgN
Inherited attributes. Zero or more arguments.
L1
, L2
, LN
Zero or more local variables.
r,
r2
Rules
g
A grammar
p
A generator expression
my_grammar
A user defined grammar
Terminology
RT(Arg1,
Arg2,
... ,ArgN)
.
The signature specifies the synthesized (return value) and inherited
(arguments) attributes.
locals<L1, L2, ..., LN>
. The local variables.
The delimit-generator type
Template Arguments
Iterator
The iterator type you will use for parsing.
A1
, A2
, A3
Can be one of 1) Signature 2) Locals 3) Delimiter.
Expression |
Description |
---|---|
|
Rule declaration. |
|
Copy construct rule |
|
Assign rule |
|
Return an alias of |
|
Get a copy of |
|
Set the name of a rule |
|
Get the name of a rule |
debug(r) |
Debug rule |
|
Rule definition |
|
Auto-rule definition. The attribute of |
template <typename OutputIterator> struct my_grammar : grammar<OutputIterator, A1, A2, A3> { my_grammar() : my_grammar::base_type(start, name) { // Rule definitions start = /* ... */; } rule<OutputIterator, A1, A2, A3> start; // more rule declarations... };
|
Grammar definition. |
my_grammar<OutputIterator> g |
Instantiate a grammar |
|
Set the name of a grammar |
|
Get the name of a grammar |