modern-compiler-ml/tiger/chap2/driver.sml

18 lines
357 B
Standard ML
Raw Normal View History

structure Parse =
struct
fun parse filename =
let val file = TextIO.openIn filename
fun get _ = TextIO.input file
val lexer = Mlex.makeLexer get
fun do_it() =
let val t = lexer()
in print t; print "\n";
if substring(t,0,3)="EOF" then () else do_it()
end
in do_it();
TextIO.closeIn file
end
end