program Program Either Error Bool program varDef funDef processes isLe

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
program :: Program -> Either Error Bool
program (varDef, funDef, processes) | isLeft checkFuns = Left errFuns
| isLeft checkProcs = Left errProcs
| maybeMain == Nothing = Left NoMain
| otherwise = Right True
where state = createState varDef
checkFuns = checkFunctions funDef funDef state
checkProcs = checkProcedures processes funDef processes state
(Left errFuns) = checkFuns
(Left errProcs) = checkProcs
maybeMain = lookup "main" processes