ExpressImpl.mesa
Express provides the client a way to evaluate an arithmetic expression given in a rope (generally from the user), typically faster than Interpreter or JaM, especially if the same function is used repeatedly.
Created Thursday, June 28, 1984 10:25 am PDT
Last edited by Eric Nickell, July 18, 1984 4:04:21 pm PDT
DIRECTORY
Express,
ExpressParser,
ExpressProc,
ExpressToken,
ExpressTree,
IO USING [RIS];
ExpressImpl: CEDAR PROGRAM
IMPORTS ExpressParser, ExpressProc, ExpressToken, IO
EXPORTS Express
~ {
OPEN Express, EP: ExpressProc, ET: ExpressTree;
XTree: TYPE ~ ET.XTree;
Throwing away used functions
FreeFcn: PUBLIC PROC [fcn: Fcn] ~ {
EP.FreeProcedure[fcn];
};
Function Parsing
RopeToFcn: PUBLIC PROC [expression: ROPE, symbols: Symbols, cProcs: ClientProcList ← NIL, oldFcn: Fcn ← NIL] RETURNS [fcn: Fcn] ~ {
Definitions
ts: ExpressToken.TokenStream ← ExpressToken.TokenStreamFromIOStream[IO.RIS[expression]];
Main Routine for RopeToFcn[]...At last!
exp: XTree ← ExpressParser.ParseExpression[ts, symbols, cProcs];
fcn ← LOOPHOLE[ExpressProc.GetProc[exp, oldFcn]];
End of Main Routine
};
}.