Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/driver/main.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/driver/main.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2148, Sun Feb 17 17:56:50 2013 UTC revision 2149, Sun Feb 17 18:22:12 2013 UTC
# Line 24  Line 24 
24    
25      exception ERROR      exception ERROR
26    
27      fun quitWithError srcFile = raise Fail("Error in compiling " ^ srcFile)      fun quitWithError srcFile = raise ERROR
28    
29    (* check for errors and report them if there are any *)    (* check for errors and report them if there are any *)
30      fun checkForErrors errStrm = (      fun checkForErrors errStrm = (
# Line 33  Line 33 
33              then quitWithError (Error.sourceFile errStrm)              then quitWithError (Error.sourceFile errStrm)
34              else ())              else ())
35    
   
36    (* compiler front end (parsing, typechecking, and simplification *)    (* compiler front end (parsing, typechecking, and simplification *)
37      fun frontEnd filename = let      fun frontEnd filename = let
38            val errStrm = Error.mkErrStream filename            val errStrm = Error.mkErrStream filename
# Line 53  Line 52 
52                  end) ()                  end) ()
53          (***** TYPECHECKING *****)          (***** TYPECHECKING *****)
54            val _ = PhaseTimer.start Timers.timeTypechecker            val _ = PhaseTimer.start Timers.timeTypechecker
55            val ast = (Typechecker.check errStrm parseTree) handle Typechecker.Error => AST.Program[]            val ast = (Typechecker.check errStrm parseTree)
56            val _ = PhaseTimer.stop Timers.timeTypechecker            val _ = PhaseTimer.stop Timers.timeTypechecker
57            val _ = checkForErrors errStrm            val _ = checkForErrors errStrm
58            val _ = ASTPP.output (Log.logFile(), ast) (* DEBUG *)            val _ = ASTPP.output (Log.logFile(), ast) (* DEBUG *)
# Line 96  Line 95 
95    
96      fun usage cmd = TextIO.output(TextIO.stdErr, Options.usage cmd)      fun usage cmd = TextIO.output(TextIO.stdErr, Options.usage cmd)
97    
98        fun handleExn ERROR = OS.Process.failure
99          | handleExn exn = (
100              err (concat [
101                  "uncaught exception ", General.exnName exn,
102                  " [", General.exnMessage exn, "]\n"
103                ]);
104              List.app (fn s => err (concat ["  raised at ", s, "\n"])) (SMLofNJ.exnHistory exn);
105              OS.Process.failure)
106    
107      fun main (name: string, args: string list) = let      fun main (name: string, args: string list) = let
108            val {help, log, target, defs, file} =            val {help, log, target, defs, file} =
109                  (Options.parseCmdLine args)                  (Options.parseCmdLine args)
# Line 121  Line 129 
129                        Stats.report ();                        Stats.report ();
130                        Log.reportTiming Timers.timeCompiler;                        Log.reportTiming Timers.timeCompiler;
131                        OS.Process.success                        OS.Process.success
132                      ) handle exn => (                      ) handle exn => handleExn exn
                         err (concat [  
                             "uncaught exception ", General.exnName exn,  
                             " [", General.exnMessage exn, "]\n"  
                           ]);  
                         List.app (fn s => err (concat ["  raised at ", s, "\n"]))  
                           (SMLofNJ.exnHistory exn);  
                         OS.Process.failure)  
133                      else (err "invalid command-line inputs\n"; OS.Process.failure)                      else (err "invalid command-line inputs\n"; OS.Process.failure)
134                  end                  end
135            end            end
             handle ERROR => OS.Process.failure  
136    
137    end    end

Legend:
Removed from v.2148  
changed lines
  Added in v.2149

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0