file PGSConDefs.mesa
last modified by Satterthwaite, January 10, 1983 4:22 pm
Last Edited by: Maxwell, August 8, 1983 11:17 am
DIRECTORY
IO: TYPE USING [STREAM],
PGSTypes: TYPE USING [
Aliases, LongDes, LongPointer, Options, ProdInfo, RhsChar, SymTab, SymInfo, TokenInfo,
alternateLim, maxProd, maxRhsSymbols, maxRule, pssLim, rhsLim, symTabSize, tokenSize,
GetBit, SetBit],
PrincOps: TYPE USING [bitsPerWord, charsPerWord, wordsPerPage],
Rope: TYPE USING [ROPE],
TimeStamp: TYPE USING [Stamp];
PGSConDefs: DEFINITIONS IMPORTS PGSTypes = {
machine parameters
cpw: NAT = PrincOps.charsPerWord;
pageSize: NAT = PrincOps.wordsPerPage;
wordLength: NAT = PrincOps.bitsPerWord;
maxCharCode: NAT = CHAR.LAST.ORD;
common compile time constants
outbufLim: NAT = 90;
PGSScan compile time constants
alternateLim: CARDINAL = PGSTypes.alternateLim;
maxProd: CARDINAL = PGSTypes.maxProd;
maxRhsSymbols: CARDINAL = PGSTypes.maxRhsSymbols;
maxRule: CARDINAL = PGSTypes.maxRule;
pssLim: CARDINAL = PGSTypes.pssLim;
rhsLim: CARDINAL = PGSTypes.rhsLim;
symTabSize: CARDINAL = PGSTypes.symTabSize;
tokenSize: CARDINAL = PGSTypes.tokenSize;
wordsForToken: CARDINAL = (tokenSize+cpw-1)/cpw;
query: CHAR = '?; -- marker character in PGSformat
PGSLALR constants
maxStateNum: CARDINAL = 400;
stateExt: CARDINAL = 100;
maxTabEntries: CARDINAL = 7000;
tabExt: CARDINAL = 1000;
maxContexts: CARDINAL = 960;
PGSTab constants
defaultMarker: CARDINAL = 0;
structures built and exported by PGSControl, used by PGSFormat and PGSBcd
pgsVersion: VAR TimeStamp.Stamp;
sourceVersion: VAR TimeStamp.Stamp;
sourceName: VAR Rope.ROPE;
objectVersion: VAR TimeStamp.Stamp;
structures built by PGSScan, exported by PGSControl, used by PGSLALR and PGSTab
warningsLogged: VAR BOOL;
eofMark: VAR CARDINAL; -- last terminal
totalTokens: VAR CARDINAL; -- size of grammar vocabulary
numProd: VAR CARDINAL; -- number of productions
numRules: VAR CARDINAL; -- number of rules
nextAlias: VAR CARDINAL; -- number of aliased terminal symbols
flags: VAR ARRAY PGSTypes.Options OF BOOL;
symTab: VAR PGSTypes.SymTab;
symInfo: VAR PGSTypes.SymInfo;
aliases: VAR PGSTypes.Aliases;
tokenInfo: VAR PGSTypes.TokenInfo;
prodInfo: VAR PGSTypes.ProdInfo;
rhsChar: VAR PGSTypes.RhsChar;
structures built by PGSLALR, exported by PGSControl, used by PGSTab
sLim, tEntries, ntEntries: VAR CARDINAL;
structures built by PGSLALR, exported by PGSControl, used by PGSControl and PGSLALR
bitstrSize: VAR CARDINAL;
procedures
LongPointer: TYPE = PGSTypes.LongPointer;
LongDes: TYPE = PGSTypes.LongDes;
storage management, exported by PGSInterface and PGSControl
zone: VAR UNCOUNTED ZONE;
MakeArray: PROC [length, width: CARDINAL] RETURNS [LongDes];
Expand: PROC [des: LongDes, width, ext: CARDINAL] RETURNS [LongDes];
FreeArray: PROC [des: LongDes];
stream input/output, exported by PGSControl
seterrstream: PROC;
setoutstream: PROC [dotstring: Rope.ROPE];
resetoutstream: PROC;
closeoutstream: PROC;
cleanupstreams: PROC;
inchar: PROC RETURNS [c: CHAR, end: BOOL];
getindex: PROC RETURNS [CARDINAL];
setindex: PROC [index: CARDINAL];
outchar: PROC [c: CHAR, n: INTEGER];
outeol: PROC [n: INTEGER];
outnum: PROC [val: INTEGER, cols: NAT, signChar: CHAR←'-];
outstring: PROC [string: Rope.ROPE];
outtab: PROC;
outtime: PROC;
openwordstream: PROC [scratch: BOOLTRUE];
closewordstream: PROC;
inword: PROC RETURNS [CARDINAL];
outword: PROC [n: CARDINAL];
outblock: PROC [address: LongPointer, words: CARDINAL];
bit manipulation, exported by PGSControl
FindBit: PROC [num: CARDINAL, source: LongPointer] RETURNS [BOOL] =
INLINE {RETURN [PGSTypes.GetBit[source+num/wordLength, num MOD wordLength] # 0]};
InsertBit: PROC [num: CARDINAL, sink: LongPointer] =
INLINE {PGSTypes.SetBit[1, sink + num/wordLength, num MOD wordLength]};
orCount: VAR CARDINAL;
OrBits: PROC [source, sink: LongPointer];
errors, exported by PGSControl
PGSFail: ERROR;
implemented by PGSScan
OutToken: PROC [symbol: CARDINAL] RETURNS [CARDINAL];
CheckOut: PROC;
implemented by PGSLALR
LALRGen: PROC RETURNS [BOOL];
implemented by PGSTab
TabGen: PROC [prefix, suffix: PROC] RETURNS [BOOL];
OutModule: PROC [typename, modfname: Rope.ROPE, long: BOOLFALSE];
implemented by PGSFormat
Format: PROC [table, type, export: Rope.ROPE];
PrintGrammar: PROC;
implemented by PGSBcd
WriteBcdHeader: PROC [
outStream: IO.STREAM,
tableId, binaryId: Rope.ROPE, -- file being written
interfaceId, fileId: Rope.ROPE, -- interface being exported
altoCode: BOOLFALSE];
FixupBcdHeader: PROC;
implemented by PGSSymbols
WriteSymbols: PROC [s: IO.STREAM, moduleId: Rope.ROPE];
}.