LIDO is a specification language for abstract syntax trees. Here's a LIDO specification corresponding to Appel's Grammar 1.3:
This macro is invoked in definition 49.
RULE CompoundStm: Stm ::= Stm ';' Stm END;
RULE AssignStm: Stm ::= id ':=' Exp END;
RULE PrintStm: Stm ::= 'print' '(' ExpList ')' END;
RULE IdExp: Exp ::= id END;
RULE NumExp: Exp ::= num END;
RULE OpExp: Exp ::= Exp Binop Exp END;
RULE EseqExp: Exp ::= '(' Stm ',' Exp ')' END;
RULE PairExpList: ExpList ::= Exp ',' ExpList END;
RULE LastExpList: ExpList ::= Exp END;
RULE Plus: Binop ::= '+' END;
RULE Minus: Binop ::= '-' END;
RULE Times: Binop ::= '*' END;
RULE Div: Binop ::= '/' END;
Each rule is bracketed by the delimiters RULE and END;,
its name is given as a label rather than a parenthesized suffix,
and Appel's ``
'' is rendered as ::=.
Grammar 1.3 doesn't define the type of the objects used to represent non-literal terminal symbols (here id and num), nor does it provide any handle for the root of the tree. Both of these deficiencies must be repaired:
This macro is invoked in definition 49.
RULE Axiom: Program ::= Stm END;
TERM id: CharPtr;
TERM num: int;
LIDO requires that every type be represented by an identifier. Thus it is not possible to use the type char* directly in a LIDO specification. CharPtr is used here to represent char*, and must be declared: