Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Attributes of Nonterminals

Nonterminals are the main means of constructing more complex parsers out of simpler ones. The nonterminals in the parser world are very similar to functions in an imperative programming language. They can be used to encapsulate parser expressions for a particular input sequence. After being defined, the nonterminals can be used as 'normal' parsers in more complex expressions whenever the encapsulated input needs to be recognized. Parser nonterminals in Spirit.X3 usually return a value (the synthesized attribute).

The type of the synthesized attribute as to be explicitly specified while defining the particular nonterminal. Example (ignore ID for now):

x3::rule<ID, int> r;

PrevUpHomeNext