Parsetree
Every node in the parse tree is syntactically of type LaNode. A LaNode has
the following fields:
- int name
- int typ
- int notation
- int stmnt
- int state
- LaNode *step changed (was int)
- LaNode *up changed (was LaExpr)
- LaNode *low changed (was LaExpr)
- LaExpr *indices
- Vect op changed (was int)
- LaNode *parent
- LaNode *children
- LaNode *next
- LaNode *cond new
- LaNode *elsechild new
- LaNode *arguments new
Since in such a LaNode different "types" of program constructs can be
stored, the validity and the precise semantics of the entries depends on
these types of program constructs. Currently, the following types (field
typ in LaNode) are planned:
In the rest of this document we describe for each of the above types the
valid fields including their semantics.
- assignments
- typ
- ASSIGN
- name
- number of the left hand side (LHS) variable in the symbtab
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- pointer to the first affine index expression of the LHS
of the assignment--if it is an array
- state
- according to Frank
- op
- [ ASSIGN,...] List of all Tokens up to the next
LaNode, e.g. brackets
- parent
- pointer to the enclosing loop nest
- children
- pointer to the first RHS expression
- low
- unused
- up
- unused
- step
- unused
- cond
- unused
- elsechild
- unused
- arguments
- unused
- for loops
- typ
- FORLOOP
- name
- number of the index variable in the symbtab = number of the loop
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- unused
- notation
- syntactical format/language
- indices
- unused
- state
- DO | DOALL | DOACROSS
- op
- unused
- parent
- pointer to the enclosing loop
- children
- pointer to the loop body
- low
- pointer to the expression representing the lower bound
- up
- pointer to the expression representing the upper bound
- step
- pointer to the expression representing the loop stride
- cond
- unused
- elsechild
- unused
- arguments
- unused
- conditional statements
- typ
- IF
- name
- unused
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- unused
- state
- unused
- op
- tokens following "if" (e.g. brackets)
- parent
- pointer to the enclosing loop nest
- children
- pointer to the then branch
- low
- unused
- up
- unused
- step
- unused
- cond
- pointer to the expression representing the if condition
- elsechild
- pointer to the else branch
- arguments
- unused
- skip statements (nop)
- typ
- SKIP
- name
- unused
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- unused
- state
- unused
- op
- unused
- parent
- pointer to the enclosing loop nest
- children
- unused
- low
- unused
- up
- unused
- step
- unused
- cond
- unused
- elsechild
- unused
- arguments
- unused
- while loops
- typ
- WHILELOOP
- name
- number of the index variable in the symbtab
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- unused
- state
- DO | DOALL | DOACROSSS (??)
- op
- unused
- parent
- pointer to the enclosing loop nest
- children
- pointer to the loop body
- low
- pointer to the expression representing the lower bound
- up
- unused
- step
- pointer to the expression representing the loop stride
- cond
- pointer to the expression representing the continuation condition
- elsechild
- unused
- arguments
- unused
- break statements
- typ
- BREAK
- name
- unused
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- unused
- state
- unused
- op
- unused or tokens following "break" (e.g. brackets for conditions)
- parent
- pointer to the enclosing loop nest
- children
- not clear yet
- low
- unused
- up
- unused
- step
- unused
- cond
- pointer to the expression representing the break condition (if any)
- elsechild
- not clear yet
- arguments
- unused
- function declaration (types in the symbtab?)
- typ
- FCTDECL
- name
- number of the function name in the symbtab
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- unused
- state
- unused
- op
- unused
- parent
- pointer to the enclosing loop nest nil
- children
- pointer to the function body
- low
- unused
- up
- unused
- step
- unused
- cond
- unused
- elsechild
- unused
- arguments
- pointer to the first argument (symbtab-entries, to be refined!)
- procedure calls (function calls are expressions with state FUNCTION_CALL)
- typ
- PROCCALL
- name
- number of the procedure name in the symbtab
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- unused
- state
- unused
- op
- unused
- parent
- pointer to the enclosing loop nest
- children
- unused
- low
- unused
- up
- unused
- step
- unused
- cond
- unused
- elsechild
- unused
- arguments
- pointer to the expression representing the first argument
- parts of expressions
- typ
- EXPR
- name
- number of the variable in the symbtab or constant number
- next
- pointer to the next argument (only if expr is an argument,
either for functions or procedures; only the first expression part of the
children-linked list points to the first expression part of the next
argument)
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- pointer to the first affine index expression of the
variable--if it is an array, or an affine expression if state = INDEX,
meaning that the whole LaNode is the corresponding LaExpression
- state
- according to Frank but additional states: INDEX, EMPTY (only
used for brackets at the very beginning of lower and upper loop bounds)
- op
- List of all Tokens up to the next LaNode, e.g. brackets and the
succeeding operators
- parent
- pointer to the enclosing loop nest
- children
- pointer to next part of the same expression
- low
- unused
- up
- unused
- step
- unused
- cond
- unused
- elsechild
- unused
- arguments
- pointer to the first expression representing an argument, if
state = FUNCTION_CALL
- placement directive
- typ
- ON
- name
- unused
- next
- pointer to next program construct on the same hierarchy level
- stmnt
- number of the statement
- notation
- syntactical format/language
- indices
- pointer to the first affine index expression of the processor mapping (should it better be argument?)
- state
- unused
- op
- tokens following "on" (e.g. brackets)
- parent
- pointer to the enclosing loop nest
- children
- pointer to the body
- low
- unused
- up
- unused
- step
- unused
- cond
- unused
- elsechild
- unused
- arguments
- unused
Martin Griebl