Import Upstream version 20180207
[hcoop/debian/mlton.git] / mlyacc / examples / fol / interface.sml
1 (* Externally visible aspects of the lexer and parser *)
2
3 signature INTERFACE =
4 sig
5
6 type pos
7 val line : pos ref
8 val init_line : unit -> unit
9 val next_line : unit -> unit
10 val error : string * pos * pos -> unit
11
12 type arg
13 val nothing : arg
14
15 end (* signature INTERFACE *)
16
17 functor Interface () : INTERFACE =
18 struct
19
20 type pos = int
21 val line = ref 0
22 fun init_line () = (line := 1)
23 fun next_line () = (line := !line + 1)
24 fun error (errmsg,line:pos,_) =
25 TextIO.output(TextIO.stdOut,"Line " ^ (Int.toString line) ^ ": " ^ errmsg ^ "\n")
26
27 type arg = unit
28
29 val nothing = ()
30
31 end (* functor INTERFACE *)