next up previous
Next: Expressions Up: Phrase Structure Previous: Preprocessing numbers


Syntactic structure

A type-con file contains the context-free grammar describing how the structure of a program is determined from the sequence of tokens.

Phrase.con[6]:

Syntactic elements[3]
This macro is attached to a product file.

In the syntactic notation used here, syntactic categories (nonterminals) are indicated by words in this type, and literal words and character set members (terminals) are enclosed in apostrophes ' '. The underscore character _ is used instead of the standard's hyphen - within symbols. A colon (:) following a nonterminal introduces its definition. Alternative definitions are separated by slashes (/), and the definition is terminated by a period.

CHANGEME: There should be a description of the BNF extensions here, as well as a brief discussion of the need to use them in order to implement certain lists.

An optional symbol is indicated by adding _opt to the name.

Optional symbols are defined implicitly in the standard, but explicit definitions are required in order to generate a parser:

Syntactic elements[7]:

type_qualifier_list_opt:      / type_qualifier_list .
constant_exp_opt:             / constant_expression .
expression_opt1:              / expression .
expression_opt2:              / expression .
argument_expression_list_opt: / argument_expression_list .
init_declarator_list_opt:     / init_declarator_list .
This macro is defined in definitions 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, and 27.
This macro is invoked in definition 6.



Subsections
next up previous
Next: Expressions Up: Phrase Structure Previous: Preprocessing numbers
2008-08-30