1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
(* init for interactive mode *)
_require "../../src/basis.smi"
_require "../../src/smlformat-lib.smi"
_require local "../../src/basis/main/SMLSharp_Runtime.smi"
_require local "../../src/compiler/libs/config/main/Config.smi"
_require local "../../src/compiler/data/symbols/main/Loc.smi"
_require local "../../src/compiler/data/control/main/Control.smi"
_require "../../src/compiler/extensions/usererror/main/UserError.ppg.smi"
_require "../../src/compiler/libs/toolchain/main/Filename.smi"
_require "../../src/compiler/compilerIRs/absyn/main/InterfaceName.ppg.smi"
_require local "../../src/compiler/libs/toolchain/main/CoreUtils.smi"
_require local "../../src/compiler/libs/toolchain/main/LLVMUtils.smi"
_require local "../../src/compiler/libs/toolchain/main/TempFile.smi"
_require local "../../src/compiler/compilePhases/parser/main/Parser.smi"
_require local "../../src/compiler/compilePhases/toplevel/main/Top.smi"
_require local "../../src/compiler/compilePhases/main/main/Main.smi"
_require local "../../src/compiler/compilePhases/main/main/Interactive.smi"
_require local "../../src/compiler/compilePhases/main/main/UserFileMap.smi"
_require local "../../src/compiler/extensions/reflection/main/ReifiedTerm.ppg.smi"
(* needed to make the prelude library available *)
_require "../../src/prelude.smi" init
structure Compiler =
struct
(* some errors occurred during initialization *)
exception Init of string
(* some compile errors or warnings occurred during compilation.
* The first "string" is the formatted error message. *)
exception CompileError of string * UserError.errorInfo list
(* exceptions raised by "execute" when the program aborts *)
exception Failure of int * string
exception CoreDumped of string
exception Signaled of int * string
(* found an uncaught exception during interactive execution
* The first "string" is the formatted error message. *)
exception UncaughtException of string * exn
type srcfile = string
type objfiles (= list)
type exefile (= string)
type error = UserError.errorInfo
val systemBaseDir : Filename.filename
val dataDir : Filename.filename
val dataFile : string -> Filename.filename
(* initialize this driver *)
val init : unit -> unit
(* compile and execute the given SML# program.
* These are provided for compiler and library tests.
* The entire source code is given to the compiler at once.
*)
val eval : string -> unit
val eval' : string -> {errors : error list}
val evalFile : string -> unit
val evalFile' : string -> {errors : error list}
(* emulation of interactive mode (with the value printer).
* These are provided for interactive mode and value printer tests.
* The input code is splitted by semicolons and is read step-by-step.
*)
val interactive : string -> {prints : string list}
val interactive' : string -> {errors : error list, prints : string list}
val interactiveFile : string -> {prints : string list}
val interactiveFile' : string -> {errors : error list, prints : string list}
(* batch compilation *)
val compile : string list -> objfiles
val compile'
: string list
-> {objfiles : objfiles,
errors : error list,
dependency : InterfaceName.file_dependency option list}
val link : string -> objfiles -> exefile
val link' : string
-> objfiles
-> {exefile : exefile,
errors : error list,
dependency : InterfaceName.file_dependency option}
val execute : exefile -> unit
val raiseCompileError : error list -> 'a
val checkCompileError : ['a#{errors : error list}. 'a -> 'a]
end
|