-- JunoSyntax.mesa
-- June 6, 1983 2:00 pm
-- Last Edited by: Gnelson, December 10, 1983 10:54 pm

DIRECTORY Lisp, Atom, Rope;

JunoSyntax: DEFINITIONS IMPORTS Atom =
BEGIN

Value: TYPE = Lisp.Value;

Command, Alist, Varlist, Formula, 
Termlist, ProcName, PredName, FunName, PredDef, FunDef, ProcDef, 
Variable, GuardedCommand, Term: TYPE = Value;

IsProcDef: PUBLIC PROC[v:Value] RETURNS [BOOL];
  -- distinguishes v from FunDefs and PredDefs, does not do full
  -- syntax check
BodyOfProcDef: PUBLIC PROC[v:ProcDef] RETURNS [Command];
ProcOfProcDef: PUBLIC PROC[v:ProcDef] RETURNS [ProcName];
Varlist1OfProcDef: PUBLIC PROC[v:ProcDef] RETURNS [Varlist];
  -- The by var parameters
Varlist2OfProcDef: PUBLIC PROC[v:ProcDef] RETURNS [Varlist];
  -- The by val parameters

IsFunDef: PUBLIC PROC[v:Value] RETURNS [BOOL];
  -- distinguishes v from ProcDefs and PredDefs, does not do full
  -- syntax check
BodyOfFunDef: PUBLIC PROC[v:FunDef] RETURNS [Formula];
FunOfFunDef: PUBLIC PROC[v:FunDef] RETURNS [FunName];
VarlistOfFunDef: PUBLIC PROC[v:FunDef] RETURNS [Varlist];
ResultnameOfFunDef: PUBLIC PROC[v:FunDef] RETURNS [Variable];

IsPredDef: PUBLIC PROC[v:Value] RETURNS [BOOL];
BodyOfPredDef: PUBLIC PROC[v:PredDef] RETURNS [Formula];
PredOfPredDef: PUBLIC PROC[v:PredDef] RETURNS [PredName];
VarlistOfPredDef: PUBLIC PROC[v:PredDef] RETURNS [Varlist];

IsConjunction: PUBLIC PROC[v:Formula] RETURNS [BOOL];
LHSOfConjunction: PUBLIC PROC[v:Formula] RETURNS [Formula];
RHSOfConjunction: PUBLIC PROC[v:Formula] RETURNS [Formula];

IsParenthesized: PUBLIC PROC[v:Value] RETURNS [BOOL];
ContentsOfParentheses: PUBLIC PROC[v:Value] RETURNS [Value];

IsQuantification: PUBLIC PROC[v:Formula] RETURNS [BOOL];
QuantifierOfQuantification: PUBLIC PROC[v:Formula] RETURNS [Value];
QuantifieeOfQuantification: PUBLIC PROC[v:Formula] RETURNS [Formula];
QuantifierVarlistOfQuantification: PUBLIC PROC[v:Formula] RETURNS [Varlist];

IsAtomicFormula: PUBLIC PROC[v:Formula] RETURNS [BOOL];
PredOfAtomicFormula: PUBLIC PROC[v:Formula] RETURNS [PredName];
TermlistOfAtomicFormula: PUBLIC PROC[v:Formula] RETURNS [Termlist];
MakeAtomicFormula: PUBLIC PROC[p: PredName, tl: Termlist] RETURNS [Formula];

IsTerm: PUBLIC PROC[v:Value] RETURNS [BOOL];
FunctionOfTerm: PUBLIC PROC[v:Term] RETURNS [FunName];
TermlistOfTerm: PUBLIC PROC[v:Term] RETURNS [Termlist];

IsConstant: PUBLIC PROC[v:Value] RETURNS [BOOL];

IsSkip: PUBLIC PROC[v:Value] RETURNS [BOOL];

IsAbort: PUBLIC PROC[v:Value] RETURNS [BOOL];

IsComposition: PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
LHSOfComposition: PUBLIC PROC[v:GuardedCommand] RETURNS [Command];
RHSOfComposition: PUBLIC PROC[v:GuardedCommand] RETURNS [Command];

IsSuchthatCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
VarlistOfSuchthatCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [Varlist];
PredOfSuchthatCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [PredName];

IsAssignmentCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
VarlistOfAssignmentCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [Varlist];
TermlistOfAssignmentCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [Termlist];

IsProcCall: PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
ProcOfProcCall: PUBLIC PROC[v:GuardedCommand] RETURNS [ProcName];
VarlistOfProcCall: PUBLIC PROC[v:GuardedCommand] RETURNS [Varlist];
TermlistOfProcCall: PUBLIC PROC[v:GuardedCommand] RETURNS [Termlist];

IsCedarCall: PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
ProcOfCedarCall: PUBLIC PROC[v:GuardedCommand] RETURNS [ProcName];
ModuleOfCedarCall: PUBLIC PROC[v:GuardedCommand] RETURNS [ProcName];
VarlistOfCedarCall: PUBLIC PROC[v:GuardedCommand] RETURNS [Varlist];
TermlistOfCedarCall: PUBLIC PROC[v:GuardedCommand] RETURNS [Termlist];

IsAlternatingCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
BodyOfAlternatingCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [GuardedCommand];

IsIterativeCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
BodyOfIterativeCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [GuardedCommand];

IsCompoundGuardedCommand: 
  PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
LHSOfCompoundGuardedCommand: 
  PUBLIC PROC[v:GuardedCommand] RETURNS [GuardedCommand];
RHSOfCompoundGuardedCommand: 
  PUBLIC PROC[v:GuardedCommand] RETURNS [GuardedCommand];

IsSimpleGuardedCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [BOOL];
PredOfSimpleGuardedCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [PredName];
CommandOfSimpleCommand: PUBLIC PROC[v:GuardedCommand] RETURNS [Command];
VarlistOfSimpleGuardedCommand: PUBLIC PROC[v:GuardedCommand] RETURNS  [Varlist];

KernelPredicate: PUBLIC PROC [p: PredName] RETURNS [BOOLEAN];

foo: ATOM;

Gensym: PROC RETURNS [Variable];

IsVar: PROC[v: Value] RETURNS [BOOL];

quote: ATOM;
isPairOf: ATOM;
isSumOf: ATOM;
isPositive: ATOM;
isProductOf: ATOM;

leftpren: ATOM;
colon: ATOM;
semicolon: ATOM;
comma: ATOM;
assign: ATOM;
eq: ATOM;
neq: ATOM;
lt: ATOM;
gt: ATOM;
le: ATOM;
ge: ATOM;
ltop: ATOM;
gtop: ATOM;
leop: ATOM;
geop: ATOM;
do: ATOM;
if: ATOM;
abort: ATOM;
skip: ATOM;
st: ATOM;
elseif: ATOM;
then: ATOM;
and: ATOM;
ex: ATOM;
para: ATOM;
cong: ATOM;
perp: ATOM;
means: ATOM;
plus: ATOM;
minus: ATOM;
times: ATOM;
divide: ATOM;
div: ATOM;
plusop: ATOM;
minusop: ATOM;
timesop: ATOM;
divideop: ATOM;
implies: ATOM;
or: ATOM;
dot: ATOM;
rel: ATOM;
leftbracket: ATOM;
fi: ATOM;
od: ATOM;
rightpren: ATOM;
rightbracket: ATOM;
constant: ATOM;
cons: ATOM;
car: ATOM;
cdr: ATOM;
proc: ATOM;
pred: ATOM;
func: ATOM;
true: ATOM;
false: ATOM;

END.