structure Prac7 : sig datatype BoolExp = << of IntExp * IntExp | == of IntExp * IntExp | Bool of bool and IntExp = ++ of IntExp * IntExp | Const of int | Value of string and Program = := of string * IntExp | If of BoolExp * Program | Seq of Program * Program | While of BoolExp * Program val parseTINY : string -> Program end = struct local structure Basic = BasicFUN() structure Keyword = KeywordFUN(Basic) structure Lex = LexicalFUN(structure Basic = Basic and Keyword = Keyword) structure Parse = ParseFUN(Lex) structure Tiny = Tiny structure ParseTiny = ParseTINYFUN(structure Parse=Parse and TINY = Tiny) in exception SynError = Parse.SynError val parseTINY = Parse.reader ParseTiny.getStatement open Tiny end end ; (* infix := << ++ ** parseTINY "a := 10; b := 0" ; parseTINY "while 0 < a do b := a + b ; a := a + ~ 1 end" parseTINY"a := 10 ;b := 0 ;while 0 < a do b := a + b ; a := a + ~1 end"; *)