== == (= occam two syntax tree definition 30-Jan-1991 =) == ==
==============================================================

treenode
--------
                   actionnode
                   altnode
                   arraynode
                   arraysubnode
                   channode
                   cnode
                   condnode
                   constexpnode
                   consttablenode
                   declnode
                   dopnode
                   hiddenparamnode
                   instancenode
                   leafnode
                   listnode
                   litnode
                   mopnode
                   namenode
                   overlapnode
                   processornode
                   replcnode
                   segmentnode
                   spacenode
                   tempnode
                   valofnode
                   variantnode

                   confignode    -- config only
                   condexpnode   -- not used

Note that in many cases "specification(node)" has been written instead of
simply "node". This is to make it more obvious where specifications may be
found preceding the node. Strictly this isn't necessary, eg for process,
since "process is defined as "specification(process)" anyway.


process
-------
leafnode        == (S_STOP)
leafnode        == (S_SKIP)
leafnode        == (S_END) -- end of outermost list of declarations
cnode           == (S_SEQ, *list(specification(process)))
cnode           == (S_PAR, *list(specification(process)))
cnode           == (S_PRIPAR, *list(specification(process)))
cnode           == (S_PLACEDPAR, *list(placement))
replcnode       == (S_REPLSEQ, *name, *exp, *exp, *specification(process))
replcnode       == (S_REPLPAR, *name, *exp, *exp, *specification(process))
replcnode       == (S_PRIREPLPAR, *name, *exp, *exp, *specification(process))
replcnode       == (S_PLACEDREPLPAR, *name, *exp, *exp, *placement)
condnode        == (S_WHILE, *exp, *specification(process))
instancenode    == (S_PINSTANCE, *name, *list(exp))
actionnode      == (S_ASS, *element, *exp)
actionnode      == (S_ASS, *list(element), *list(exp))
actionnode      == (S_OUTPUT, *element, *list(outputitem))
actionnode      == (S_CASE, *exp, *list(specification(selection)))
cnode           == (S_GUY, *list(guyline))
cnode           == (S_ASM, *list(guyline))
                   specification(process)
                   input
                   choice
                   alternative

list (l)
--------
listnode        == (S_LIST, *l, *list(l))
                   NULL

specification (p)
-----------------
declnode        == (S_VALABBR, *name, *exp, *p)
declnode        == (S_ABBR, *name, *element, *p)
declnode        == (S_VALRETYPE, *name, *exp, *p)
declnode        == (S_RETYPE, *name, *element, *p)
declnode        == (S_PROCDEF, *name, *process, *p)
declnode        == (S_SFUNCDEF, *name, *valof, *p)  -- the valof is always (S_SKIP)
declnode        == (S_LFUNCDEF, *name, *valof, *p)
declnode        == (S_DECL, *list(name), NULL, *p)
declnode        == (S_DECL, *name, NULL, *p)
declnode        == (S_SPROTDEF, *name, NULL, *p)
declnode        == (S_TPROTDEF, *name, NULL, *p)
declnode        == (S_PLACE, *name, *exp, *p)    -- PLACE n AT v
declnode        == (S_WSPLACE, *name, *exp, *p)  -- PLACE n AT WORKSPACE v
declnode        == (S_WSPLACE, *name, NULL, *p)  -- PLACE n IN WORKSPACE
declnode        == (S_VSPLACE, *name, NULL, *p)  -- PLACE n IN VECSPACE

exp
---
mopnode         == (S_MOSTPOS, *stype, type)
mopnode         == (S_MOSTNEG, *stype, type)
mopnode         == (S_NEG, *operand, type)
mopnode         == (S_UMINUS, *operand, type)
mopnode         == (S_BITNOT, *operand, type)
mopnode         == (S_NOT, *operand, type)
mopnode         == (S_SIZE, *operand, type)
mopnode         == (S_EXACT, *operand, type)
mopnode         == (S_ROUND, *operand, type)
mopnode         == (S_TRUNC, *operand, type)
dopnode         == (S_AND, *exp, *operand, type)
dopnode         == (S_OR, *exp, *operand, type)
dopnode         == (S_ADD, *operand, *operand, type)
dopnode         == (S_SUBTRACT, *operand, *operand, type)
dopnode         == (S_MULT, *operand, *operand, type)
dopnode         == (S_DIV, *operand, *operand, type)
dopnode         == (S_REM, *operand, *operand, type)
dopnode         == (S_BITAND, *operand, *operand, type)
dopnode         == (S_BITOR, *operand, *operand, type)
dopnode         == (S_XOR, *operand, *operand, type)
dopnode         == (S_LSHIFT, *operand, *operand, type)
dopnode         == (S_RSHIFT, *operand, *operand, type)
dopnode         == (S_PLUS, *operand, *operand, type)
dopnode         == (S_MINUS, *operand, *operand, type)
dopnode         == (S_TIMES, *operand, *operand, type)
dopnode         == (S_EQ, *operand, *operand, type)
dopnode         == (S_NE, *operand, *operand, type)
dopnode         == (S_LS, *operand, *operand, type)
dopnode         == (S_LE, *operand, *operand, type)
dopnode         == (S_GR, *operand, *operand, type)
dopnode         == (S_GE, *operand, *operand, type)
dopnode         == (S_AFTER, *operand, *operand, type)
leafnode        == (S_DUMMYEXP)   -- null expression
                   operand

operand
-------
leafnode        == (S_TRUE)
leafnode        == (S_FALSE)
litnode         == (S_INTLIT, *wordnode)
litnode         == (S_UINTLIT, *wordnode)
litnode         == (S_INT16LIT, *wordnode)
litnode         == (S_INT32LIT, *wordnode)
litnode         == (S_INT64LIT, *wordnode)
litnode         == (S_UREALLIT, *wordnode)
litnode         == (S_REAL32LIT, *wordnode)
litnode         == (S_REAL64LIT, *wordnode)
litnode         == (S_BYTELIT, *wordnode)
litnode         == (S_UBYTELIT, *wordnode)
instancenode    == (S_FINSTANCE, *name, *list(exp))
                   table
                   element
                   valof
                   exp

table
-----
arraysubnode    == (S_ARRAYSUB, *table, *exp)
segmentnode     == (S_SEGMENT, *table, *exp, *exp)
consttablenode  == (S_STRING, *wordnode, NULL)
mopnode         == (S_CONSTRUCTOR, *list(exp))

valof
-----
valofnode       == (S_VALOF, *process, *list(exp))
                   specification(valof)

choice
------
cnode           == (S_IF, *list(specification(choice)))
replcnode       == (S_REPLIF, *name, *exp, *exp, *specification(choice))
condnode        == (S_CHOICE, *exp, *process)
                   specification(choice)

alternative
-----------
cnode           == (S_ALT, *list(specification(alternative)))
cnode           == (S_PRIALT, *list(specification(alternative)))
replcnode       == (S_REPLALT, *name, *exp, *exp, *specification(alternative))
replcnode       == (S_PRIREPLALT, *name, *exp, *exp, *specification(alternative))
altnode         == (S_ALTERNATIVE, *altguard, *altinput, *specification(process))
altnode         == (S_ALTERNATIVE, *altguard, *caseinput, NULL) -- frontend
                   specification(alternative)

altguard
--------
                   NULL
                   exp

altinput
--------
leafnode        == (S_SKIP)
                   input

outputitem
----------
dopnode         == (S_COLON2, *exp, *exp)
                   exp

input
-----
actionnode      == (S_INPUT, *element, *list(inputitem))
actionnode      == (S_DELAYED_INPUT, *element, *exp)
                   caseinput

caseinput
---------
actionnode      == (S_CASE_INPUT, *element, *list(specification(variant)))
actionnode      == (S_TAGGED_INPUT, *element, *list(inputitem))

inputitem
----------
dopnode         == (S_COLON2, *element, *element)
                   element

element
-------
arraysubnode    == (S_ARRAYSUB, *element, *exp)  -- frontend
segmentnode     == (S_SEGMENT, *element, *exp, *exp)  -- frontend
                   name

selection
---------
condnode        == (S_SELECTION, *list(exp), *specification(process))
condnode        == (S_SELECTION, *else, *specification(process))
                   specification(selection)

else
----
leafnode        == (S_ELSE)

variant
-------
variantnode     == (S_VARIANT, *list(inputitem), *specification(process))
                   specification(variant)

guyline
-------
dopnode         == (S_GUYCODE, (treenode *)*wordnode, *list(asmexp))
dopnode         == (S_GUYSTEP, (treenode *)*wordnode, NULL)
declnode        == (S_LABELDEF, *label, labelname, NULL)

asmexp
-----
mopnode         == (S_ADDRESSOF, *exp) -- only valid inside ASM, not GUY
                   exp

label
-----
leafnode        == (S_LABEL) -- type of an assembler label

name
----
namenode        == (N_VALABBR, *wordnode, *type, *specification)
namenode        == (N_ABBR, *wordnode, *type, *specification)
namenode        == (N_VALRETYPE, *wordnode, *type, *specification)
namenode        == (N_RETYPE, *wordnode, *type, *specification)
namenode        == (N_DECL, *wordnode, *type, *specification)
namenode        == (N_REPL, *wordnode, *type, *specification)
namenode        == (N_LABELDEF, *wordnode, *type, *specification)
namenode        == (N_TAGDEF, *wordnode, *list(simpleprotocol), NULL)
namenode        == (N_TPROTDEF, *wordnode, *list(tag), *specification)
namenode        == (N_SPROTDEF, *wordnode, *list(simpleprotocol), *specification)
namenode        == (N_VALPARAM, *wordnode, *type, NULL)
namenode        == (N_PARAM, *wordnode, *type, NULL)
namenode        == (N_PROCDEF, *wordnode, *list(param), *specification)
namenode        == (N_SFUNCDEF, *wordnode, *fntype, *specification)
namenode        == (N_LFUNCDEF, *wordnode, *fntype, *specification)
-- names used for routines predefined, or declared in SCs or libraries
namenode        == (N_SCPROCDEF, *wordnode, *list(param), *specification)
namenode        == (N_SCFUNCDEF, *wordnode, *fntype, *specification)
namenode        == (N_LIBPROCDEF, *wordnode, *list(param), *specification)
namenode        == (N_LIBFUNCDEF, *wordnode, *fntype, *specification)
namenode        == (N_STDLIBPROCDEF, *wordnode, *list(param), *specification)
namenode        == (N_STDLIBFUNCDEF, *wordnode, *fntype, *specification)
namenode        == (N_INLINEPROCDEF, *wordnode, *list(param), *specification)
namenode        == (N_INLINEFUNCDEF, *wordnode, *fntype, *specification)
namenode        == (N_PREDEFPROC, *wordnode, *list(param), *specification)
namenode        == (N_PREDEFFUNCTION, *wordnode, *fntype, *specification)

param
-----
                   name

tag
---
                   name

fntype
------
listnode        == (S_FNTYPE, *list(type), *list(param))

simpleprotocol
--------------
dopnode         == (S_COLON2, *stype, (S_ARRAY, NULL, *type, -1))
                   stype

stype
-----
leafnode        == (S_BOOL)
leafnode        == (S_BYTE)
leafnode        == (S_INT)
leafnode        == (S_INT16)
leafnode        == (S_INT32)
leafnode        == (S_INT64)
leafnode        == (S_REAL32)
leafnode        == (S_REAL64)
arraynode       == (S_ARRAY, *exp, *stype, dimlength)
leafnode        == (S_LABEL) -- type of an assembler label
leafnode        == (S_UNDECLARED)

type
----
leafnode        == (S_TIMER)
channode        == (S_CHAN, *protocol)
channode        == (S_PORT, *simpleprotocol)
arraynode       == (S_ARRAY, *exp, *type, dimlength)
arraynode       == (S_ARRAY, NULL, *type, -1)
                   stype

protocol
--------
leafnode        == (S_ANY)
                   name
                   simpleprotocol

placement
---------
processornode   == (S_PROCESSOR, *exp, *process)  -- config only

nodes introduced by the constant folder
---------------------------------------
constexpnode    == (S_CONSTEXP, *exp, BIT32 hi, lo)  -- exp is the original tree
consttablenode  == (S_CONSTCONSTRUCTOR, *wordnode, *operand)

nodes introduced by the alias checker
-------------------------------------
dopnode         == (S_OVERLAPCHECK, *exp, *exp)
dopnode         == (S_FOR, *exp, *exp)   -- range for overlapcheck
dopnode         == (S_EVAL, *exp, *exp)  -- evaluate and throw away LHS, return rhs

nodes introduced by the tree transformer
----------------------------------------
arraysubnode    == (S_ARRAYITEM, *exp, *element, BIT32 offset)  -- backend
segmentnode     == (S_SEGMENTITEM, *element, *exp, *exp, *subscript-exp, *check-exp, BIT32 offset) -- backend
dopnode         == (S_CSUB0, *operand, *operand)
dopnode         == (S_CCNT1, *operand, *operand)
mopnode         == (S_ELSIZE, *operand)   -- backend -- breaks tree structure
mopnode         == (S_SEGSTART, *operand) -- backend -- breaks tree structure
leafnode        == (S_PARAM_STATICLINK) -- backend
hiddenparamnode == (S_PARAM_VSP, NULL, vsp)          -- backend
hiddenparamnode == (S_FNFORMALRESULT, *type, 0)      -- backend
hiddenparamnode == (S_FNACTUALRESULT, *exp, 0)       -- backend
hiddenparamnode == (S_HIDDEN_PARAM, *exp, dimension) -- backend
altnode         == (S_ALTERNATIVE, *altguard, *specification(altinput), *specification(process)) -- backend
altnode         == (S_ALTERNATIVE, *altguard, *specification(caseinput), NULL) -- backend
cnode           == (S_BASICBLOCK, *list(process))  -- dag stuff

nodes introduced by the workspace allocator
-------------------------------------------
spacenode       == (S_SPACEUSAGE, *process, BIT32 maxwsp, datasize, vsusage, nestedvs, *name) -- backend
namenode        == (T_TEMP, *wordnode, *type, *exp)
namenode        == (T_PREEVALTEMP, *wordnode, *type, *exp)
namenode        == (T_REGTEMP, *wordnode, *type, *exp)
namenode        == (T_RESERVEDWS, *wordnode, *type, *exp)

name hash table
---------------
wordnode        == (S_NAME,    *string, len)
wordnode        == (S_ASMNAME, *string, len)  -- .WSSIZE etc
                   leafnode

nodes introduced in the configurer only
---------------------------------------
leafnode        == (S_NODE)     -- configuration
leafnode        == (S_EDGE)     -- configuration
leafnode        == (S_ARC)      -- configuration
declnode        == (S_CONFIG, *name, *process, *p)              -- configuration
declnode        == (S_NETWORK, *name, *process, *p)             -- configuration
declnode        == (S_MAPPING, *name, *process, *p)             -- configuration
declnode        == (S_PLACEON, *list(element), *element, *p)    -- configuration
arraysubnode    == (S_RECORDSUB, *element, *namenode)           -- configuration
namenode        == (N_CONFIG, *wordnode, NULL, *specification)  -- configuration
namenode        == (N_NETWORK, *wordnode, NULL, *specification) -- configuration
namenode        == (N_MAPPING, *wordnode, NULL, *specification) -- configuration
namenode        == (N_FIELD, *wordnode, NULL, *specification)   -- configuration
confignode      == (S_SET, *element, *list(attr), *list(exp))   -- configuration
confignode      == (S_CONNECT, *element, *element, *element)    -- configuration
confignode      == (S_MAP, *list(element), *element, *expression)--configuration
cnode           == (S_DO, *list(specification(process)))        -- configuration
replcnode       == (S_REPLDO, *name, *exp, *exp, *specification(process)) -- configuration

obsolete nodes
--------------
dopnode         == (S_INTERVAL, *exp, *exp)  -- obsolete
mopnode         == (S_STRUCTCONSTRUCTOR, *operand, *type) -- obsolete
replcnode       == (S_ARRAYCONSTRUCTOR, *name, *exp, *exp, *exp) -- obsolete
