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

SCM Repository

[diderot] Annotation of /branches/vis15/src/compiler/typechecker/typechecker.sml
ViewVC logotype

Annotation of /branches/vis15/src/compiler/typechecker/typechecker.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4317 - (view) (download)

1 : jhr 3401 (* typechecker.sml
2 :     *
3 :     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     *
5 :     * COPYRIGHT (c) 2015 The University of Chicago
6 :     * All rights reserved.
7 :     *)
8 :    
9 :     structure Typechecker : sig
10 :    
11 : jhr 3410 (* type check a Diderot program *)
12 : jhr 3401 val check : Error.err_stream -> ParseTree.program -> AST.program
13 :    
14 :     end = struct
15 :    
16 :     structure PT = ParseTree
17 : jhr 3410 structure E = Env
18 : jhr 3401
19 :     fun check errStrm (PT.Program{span, tree}) = let
20 : jhr 4317 val {globals, globInit, strand, init, create, update} = tree
21 : jhr 3401 val cxt = (errStrm, span)
22 : jhr 3410 val env = E.new()
23 : jhr 4317 val {const_dcls, input_dcls, other_dcls, env} =
24 :     CheckGlobals.check (env, cxt, globals)
25 :     val globInit' = Option.map (fn stm => CheckStmt.check (env, cxt, stm)) globInit
26 :     val (strand', env) = CheckStrand.check (env, cxt, strand)
27 :     val create' = CheckCreate.check (env, cxt, create)
28 :     val init' = (case init
29 :     of SOME stm => (
30 :     E.recordProp (env, Properties.GlobalInitially);
31 :     SOME(CheckStmt.check(E.initScope env, cxt, stm)))
32 :     | NONE => NONE
33 :     (* end case *))
34 :     val update' = (case update
35 :     of SOME stm => (
36 :     E.recordProp(env, Properties.GlobalUpdate);
37 :     SOME(CheckStmt.check(E.updateScope env, cxt, stm)))
38 :     | NONE => NONE
39 :     (* end case *))
40 :     val prog = AST.Program{
41 :     props = E.properties env,
42 :     const_dcls = const_dcls,
43 :     input_dcls = input_dcls,
44 :     globals = other_dcls,
45 :     globInit = globInit',
46 :     strand = strand',
47 :     create = create',
48 :     init = init',
49 :     update = update'
50 :     }
51 : jhr 3401 in
52 : jhr 3413 CheckVarUses.check (cxt, prog);
53 : jhr 4317 prog
54 : jhr 3401 end
55 :    
56 :     end

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