(* parse elaborate and call Absyn->Absyn match compiler *) signature PEMAIN = sig (* Argument is is NONE to get declaration(s) from stdin * or SOME(filename) *) (* parse, elaborate, and match-compile first declaration, then quit *) val PEMain1 : string option -> Absyn.dec * StaticEnv.staticEnv (* parse, elaborate, and match-compile all declarations *) val PEMain : string option -> Absyn.dec * StaticEnv.staticEnv end (* sig *) structure PEMain : PEMAIN = struct local structure SigMatch = SigMatchFn (structure EV = EvalEntity) structure Typecheck = TypecheckFn (val ii_ispure = InlInfo.pureInfo val ii2ty = InstantiateParam.ii2ty) structure ElabMod = ElabModFn (structure SM = SigMatch structure Typecheck = Typecheck) structure ElabTop = ElabTopFn (structure ElabMod = ElabMod) structure PU = PEUtil open Absyn in val {exportLvars=_,exportPid=_,newenv=initenv,pickle=_,pid=_} = Pup.pickBase(SavedEnv.makeSavedEnv ()) fun PEMainP parse strOpt = let val source = ParserInterface.whichSource strOpt val astdec = parse source val cinfo = CompInfo.mkCompInfo {source = source, transform = fn x : Absyn.dec => x, mkMkStamp = Stamps.newGenerator} val (rootdec, newenv) = ElabTop.elabTop (astdec, initenv, cinfo) val staticenv = StaticEnv.atop (initenv, newenv) in if CompInfo.anyErrors cinfo then raise PU.ElaborationError else (PostElab.transDec {compInfo = cinfo, env = staticenv, rootdec = rootdec}, newenv) handle x => raise x end val PEMain1 = PEMainP ParserInterface.parseOne val PEMain = PEMainP ParserInterface.parseAll end (* local *) end (* struct *)