<<With derivation tree in mind>>
There are two constructions to keep derivation process and result:
- derivation chain or simply derivation. As chain it consists of nodes
each marked by sentential form and arrows from node to node to
construct sequence.
- derivation tree (well known).
What does it mean "relationship between terminal or nonterminal
symbols"? Where?
The answer should be: in a derivation tree!
And we have:
- "the x of a y": x-node is a child of y-node;
- "a y containing an x": y-node is on the path upwards from x-node;
- "the y closest-containing an x": y-node is on the path upwards from
x-node and there is no another y-node between.
Remark: It is clear that we can define these relationships on
derivation chain, but derivation tree is better as keeps them in its
structure.
For example first sentence of 6.2.1.
"A block closest-containing a label-declaration-part in which a label
occurs shall closest-contain exactly one statement in which that label
occurs."
actually means
"A block-node closest-containing a label-declaration-part-node in
which a label-node (LN1) occurs shall closest-contain exactly one
statement-node in which label-node (LN2) with the same as LN1 label-
value occurs."
<<BNF and production>>
With BNF and its modifications (enhancements) we sometimes do not have
on the right side of "definition" a sequence of terminals and
nonterminals - we have a meta-formula. So to get production we need
one additional step: "execute" meta-formula (that means make some
decisions) and get this sequence. And exactly this sequence is
substituted on the place of left part of "definition".
For example: having definition
label-declaration-part = [ 'label' label { ',' label } ';' ] .
A first decision is to have or have not right part at all. If "Yes",
then the second is - how many labels to have? Let's say 3. And we get
production itself:
label-declaration-part = 'label' label ',' label ',' label ';'
On the right side we see exactly all kids of label-declaration-part-
node in a derivation tree.
Alex
this text is part of post: http://ashkotin.blogspot.com/2008_08_23_archive.html
created to consolidate comments.