Syntax tree

Top  Previous  Next

User interface > Debugging and executing > Syntax tree

 

When a start rule was parsed, it will be displayed together with its sub-rules in a syntax tree. By a pop-up menu breakpoints can be set at tree nodes or accompanying first sets can be shown.

 

At first the productions appear in collapsed form.

 

Collapsed form

 

tree__contracted

 

In the collapsed form only the names of the productions are shown, precede by a plus symbol  '+'. (If the productions aren't parsed, the plus '+' is absent.)

 

 

Expanded Form

 

In expanded form the names are preceded by a minus '-' and below of the name the sequence of sub-structures is displayed.  

 

 

Node icons

 

Each node of the tree is preceded by a little icon, which characterizes the type of the node. The names of the nodes are preceded by a prefix, which also denotes the type.

 

 

Icon

Type

Prefix

Node_link

Production

 

Node_link_wo

with local options

 

Node_nt

Call of a production

NT

Node_t

Terminal symbol = Token

T

Node_any

ANY-Symbol

ANY

Node_skip

SKIP symbol

SKIP

Node_alt

Alternative

Alt

Node_opt

Option

Opt

Node_rep

Repetition

Rep

Node_optrep

optional Repetition

OptRep

Node_Count

counted Repetition

Count

Node_If

IF structure

If

Node_Cond

WHILE structure

Cond

Node_br

BREAK

Br

Node_sem

Semantic action

Sem

 

 

 

Concatenation

 

Parts of a production, which follow each other, will be displayed one beneath the other, conjunct by a vertical line with little arrows. A production

 

A = a b c d

 

will be displayed as follows

 

tree_chain

 

 

Alternatives

 

For parts of a rule, which are alternative, an extra node is inserted, and beneath this node the alternatives are displayed as discrete nodes. A production:

 

A = a | b | c | d

 

will be displayed as follows

 

tree_alternatives

 

The name of the node, which combines the alternatives is constructed by the prefix "Alt_", a counter and "_of_", followed by the name of the superior node. From the name you can reconstruct the type and position of a node inside of the whole grammar.

 

 

Options and repeats

 

For options or repeats an extra node is constructed. The child node of the latter is that, what is optional or will be repeated. The production:

 

B = ( b )+

 

is displayed as follows

 

tree_rep

 

The name of an option node or a repeat node is constructed analogous to the name of an alternative node. The following expressions are used:

 

       Opt        for options

       0ptRep        for optional repeats

       Rep        for repeats

 

 

 

Semantic actions

 

At positions, where semantic actions are executed inside of a production, in the syntax tree simple nodes are displayed. The names of the nodes are constructed from "_Sem", a counter and the name of the superior production. Actions, which are directly combined with a token are not displayed.

 

Complex example

 

If one of a group of alternatives consists itself of a sequence of token and productions, this sequence is displayed as a sequence of connected nodes. The whole sequence of this alternative is separated from the other alternatives.

Example:

 

D = (B | c d | ( a )? d )+

 

would be displayed in the syntax tree as:

 

tree_complex

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German