INTERFACE CalcParse;
Generated by kyacc
original parser definition
IMPORT CalcTok;
TYPE
(* additional parse types *)
StartType = CalcTok.ParseType BRANDED "CalcParse.StartType" OBJECT END;
OtherType = CalcTok.ParseType;
expr = OtherType BRANDED "CalcParse.expr" OBJECT END;
list = StartType BRANDED "CalcParse.list" OBJECT END;
number = OtherType BRANDED "CalcParse.number" OBJECT END;
stat = OtherType BRANDED "CalcParse.stat" OBJECT END;
(* import tokens *)
ConstToken = CalcTok.ConstToken;
LETTER = CalcTok.LETTER;
DIGIT = CalcTok.DIGIT;
(* the parser *)
T <: Public;
Public = OBJECT
METHODS
setLex(lex: CalcTok.Lexer): T;
parse(exhaustInput: BOOLEAN := TRUE): StartType;
(* rules *)
empty_list(VAR result: list);
cons_list(VAR result: list; p1: list; p2: stat);
eval_stat(VAR result: stat; p1: expr);
assign_stat(VAR result: stat; p1: LETTER; p2: expr);
paren_expr(VAR result: expr; p1: expr);
add_expr(VAR result: expr; p1: expr; p2: expr);
sub_expr(VAR result: expr; p1: expr; p2: expr);
mul_expr(VAR result: expr; p1: expr; p2: expr);
div_expr(VAR result: expr; p1: expr; p2: expr);
uminus_expr(VAR result: expr; p1: expr);
ident_expr(VAR result: expr; p1: LETTER);
num_expr(VAR result: expr; p1: number);
digit_number(VAR result: number; p1: DIGIT);
cons_number(VAR result: number; p1: number; p2: DIGIT);
purge(): INTEGER;
(* Allow any internally allocated ParseTypes to be garbage collected,
even if the parser itself remains in scope. Return number of ParseType
objects allocated but not discarded (not the number of purged objects).
Can be called at any time by the thread calling get. *)
END;
(* And now, for a hack to allow compatible methods *)
(* ... without importing the original parser *)
Original_Parser = T;
Original_expr = expr;
Original_list = list;
Original_number = number;
Original_stat = stat;
(* ... and without importing the original token *)
Original_LETTER = LETTER;
Original_DIGIT = DIGIT;
END CalcParse.