LIDO - Reference Manual
Further attributes may be added as preconditions for expression evaluation
without using their values for computing the expression's result. The
additional attributes may describe a computational state that has to be reached
before the expression is evaluated. These attributes are specified by a
Expression ::= SimpExpr [ DependsClause ] DependsClause ::= '<-' DepAttrList DepAttrList ::= DepAttr | '(' DepAttrs ')' DepAttrs ::= DepAttrs ',' DepAttrs | DepAttr DepAttr ::= Attribute | RemoteAccess | RhsAttrs
GetProp (UseId.Key,0) <- UseId.PropIsSet printf ("%s ", Opr.String) <- (Expr.printed, Expr..printed)
Named terminal symbols that occur in a production represent values that are usually obtained from corresponding input tokens when the tree node is constructed. Those values can be used in both rule and symbol computations.
RULE: DefIdent ::= Ident COMPUTE DefIdent.Key = DefineIdn (DefIdent.Env, Ident); END; RULE: Point ::= '(' Numb Numb ')' COMPUTE printf ("X = %d, Y = %d\n", Numb, Numb); END; SYMBOL Point COMPUTE printf ("X = %d, Y = %d\n", TERM, TERM); END;
In rule computations the value of a terminal in the production
is denoted by the
Note: In a rule computation a non-indexed identifier that is not a name of a symbol in the production of this rule denotes some entity of the generated C program, even if it coincides with the name of a terminal that occurs in other productions.
In lower computations of a symbol
A terminal accessed in a symbol computation must exist in every production the computation is associated with.
Expressions are written as nested function calls where the basic operands are attributes, C identifiers and C literals. The functions are either predefined in LIDO or their definitions are supplied by the user in the form of C functions or macros outside the LIDO specification. There is no operator notation for expressions in LIDO.
SimpExpr ::= C_Name | C_Integer | C_Float | C_Char | C_String | Attribute | RemoteAccess | RhsAttrs | FunctionName '(' [ Arguments ] ')' Arguments ::= Arguments ',' Arguments | Expression
printf ("Val = %d\n", Expr.val) IF (LT (Expr.val, 0), 0, Expr.val)
Evaluation of a function call notation in LIDO has the same effect and result as the equivalent notation in C.
There are some predefined
All arguments of non-predefined functions must yield a (non-
Type consistency for non-