Sml 使用CM.make编译时释放结构Int

Sml 使用CM.make编译时释放结构Int,sml,smlnj,cm,Sml,Smlnj,Cm,我正在使用CM和ML-Lex编译一个lexer。当我尝试使用CM.make“sources.CM”进行编译时,它会抛出错误 errormsg.sml:7.24-7.39 Error: unbound structure: TextIO in path TextIO.instream errormsg.sml:21.26-21.38 Error: unbound structure: TextIO in path TextIO.stdIn errormsg.sml:27.18-27.30 Erro

我正在使用CM和ML-Lex编译一个lexer。当我尝试使用CM.make“sources.CM”进行编译时,它会抛出错误

errormsg.sml:7.24-7.39 Error: unbound structure: TextIO in path TextIO.instream
errormsg.sml:21.26-21.38 Error: unbound structure: TextIO in path TextIO.stdIn
errormsg.sml:27.18-27.30 Error: unbound structure: TextIO in path TextIO.stdIn
errormsg.sml:36.12-36.24 Error: unbound structure: Int in path Int.toString
还有一些和以前的一样。如果我试着使用“errormsg.sml”,一切都很好。我尝试在sources.cm中移动errormsg.sml

资料来源.cm:

Group is

$/smlnj-lib.cm
driver.sml
tokens.sig
tokens.sml
errormsg.sml
tiger.lex
errormsg.sml:

signature ERRORMSG =
sig
    val anyErrors : bool ref
    val fileName : string ref
    val lineNum : int ref
    val linePos : int list ref
    val sourceStream : TextIO.instream ref
    val error : int -> string -> unit
    exception Error
    val impossible : string -> 'a   (* raises Error *)
    val reset : unit -> unit
end

structure ErrorMsg : ERRORMSG =
struct

  val anyErrors = ref false
  val fileName = ref ""
  val lineNum = ref 1
  val linePos = ref [1]
  val sourceStream = ref TextIO.stdIn

  fun reset() = (anyErrors:=false;
                 fileName:="";
                 lineNum:=1;
                 linePos:=[1];
                 sourceStream:=TextIO.stdIn)

  exception Error

  fun error pos (msg:string) =
      let fun look(a::rest,n) =
            if a<pos then app print [":",
                               Int.toString n,
                                       ".",
                                       Int.toString (pos-a)]
               else look(rest,n-1)
            | look _ = print "0.0"
       in anyErrors := true;
          print (!fileName);
          look(!linePos,!lineNum);
          print ":";
          print msg;
          print "\n"
      end

  fun impossible msg =
      (app print ["Error: Compiler bug: ",msg,"\n"];
       TextIO.flushOut TextIO.stdOut;
       raise Error)

end
签名错误msg=
信号
val anyErrors:bool ref
val文件名:string ref
val lineNum:int ref
val linePos:int list ref
val sourceStream:TextIO.instream ref
val错误:整数->字符串->单位
异常错误
val不可能:字符串->'a(*引发错误*)
val重置:单位->单位
结束
结构ErrorMsg:ErrorMsg=
结构
val anyErrors=ref false
val fileName=ref“”
val lineNum=参考1
val linePos=参考[1]
val sourceStream=ref TextIO.stdIn
fun reset()=(anyErrors:=false;
文件名:=“”;
lineNum:=1;
linePos:=[1];
sourceStream:=TextIO.stdIn)
异常错误
有趣的错误位置(消息:字符串)=
让乐趣看(a::休息,n)=

如果您需要将
$/basis.cm
添加到
sources.cm
中。这将导入标准ML基础库:

Group is

$/basis.cm
$/smlnj-lib.cm
driver.sml
tokens.sig
tokens.sml
errormsg.sml
tiger.lex