File: ExprRead.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Created by: Mayo, July 23, 1984 3:50:47 pm PDT
Last Edited by: Mayo, July 23, 1984 6:06:17 pm PDT
-- ExprRead: Read expressions of the form 'var ← expr' or 'var ~ expr'. If the operator is '← then the expr is evaluated using symbols in a symbol table, or things in the global naming context. See Interpreter.mesa for more details. If the operator is '~ then expr is simply treated as a rope which is then assigned to var.
-- This module uses the slot named '&' in the passed symbol tables as a temporary placeholder. Anything that the caller places there might be destroyed.
DIRECTORY
AMTypes USING [TV],
SymTab USING [Ref],
Rope USING [ROPE];
ExprRead: CEDAR DEFINITIONS = BEGIN
Error: ERROR [ec: ErrorCode, msg: Rope.ROPE];
ErrorCode: TYPE = {Null,     -- never raised
CouldNotEval,       -- could not evaluate expression
NoValue,         -- expression didn't return a value
Syntax,         -- bad expression syntax
FileError,         -- could not read from file
MarkNotInTile,       -- the Mark is not in the specified cell or design
PlacedTileNotInDesign,     -- the PlacedTile is not in the specified design
ObjectMustBeTileOrDesign    -- something else was passed
};
Evaluate one expression and return a TV for it's result.
Eval: PROC [expr: Rope.ROPE, symTab: SymTab.Ref] RETURNS [AMTypes.TV];
Evaluate one assignment statement of the form 'var ← expr', and update var in the symbol table.
Assign: PROC [line: Rope.ROPE, symTab: SymTab.Ref];
Read a file that contains one assignment statement per line.
ReadFile: PROC [fileName: Rope.ROPE, symTab: SymTab.Ref];
These procedures return NIL if the operation couldn't be done, and a pointer otherwise. They don't raise errors intentionally.
TVToRope: PROC [tv: AMTypes.TV] RETURNS[Rope.ROPE];
TVToListOfRope: PROC [tv: AMTypes.TV] RETURNS[LIST OF Rope.ROPE];
TVToInt: PROC [tv: AMTypes.TV] RETURNS[REF INT];
TVToCardinal: PROC [tv: AMTypes.TV] RETURNS[REF CARDINAL]; -- value must be non-negative
TVToAtom: PROC [tv: AMTypes.TV] RETURNS[ATOM];
END.