open TextIO; use "toySyntax.sml"; use "toySemantics.sml"; exception parseError; fun cat fileName = let fun f inS = (* returns a list of char *) if endOfStream inS then (closeIn inS; []) else hd(explode(inputN(inS, 1))) :: (f inS) in f (openIn fileName) end and run fileName = case parse (lexical (cat fileName)) of (cmdErr m) => raise parseError | prog => C prog rho0 state0; (* Parser and "direct" semantics of imperative features *) (* LA, Dept Comp Sci, Monash, 1988 & CSSE, Monash .au, 2005 *)