functor PRAC6(structure Code : CodeSig) = struct val !@#$%^& = op := structure Code = Code datatype Stage = Stage1 | Stage2 | Stage3 | Stage4 | Stage5 | Stage6a | Stage6b local infix 9 :- -: structure Basic = BasicFUN() structure Keyword = KeywordFUN() structure LexCode = LexicalFUN(structure Basic = Basic and Keyword = Keyword) structure Parse = ParseFUN(LexCode) structure ParseCode = ParseCodeFUN(structure Parse=Parse and Code = Code) structure PrintCode = PrintCodeFUN(structure Code = Code) exception SynError = Parse.SynError in open Code val parseCode = Parse.reader ParseCode.code val printCode = PrintCode.prCode fun readCode f = let val file = open_in f fun read () = if end_of_stream file then "" else ExtendedIO.input_line file ^ read() val s = read() val _ = close_in file in parseCode s end fun writeCode (c,f) = let val file = open_out f in (output(file, printCode c); close_out file) end; end end ;