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 3432 - (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 :     val {globals, strand, init, create, update} = tree
21 :     val cxt = (errStrm, span)
22 : jhr 3410 val env = E.new()
23 : jhr 3409 val {const_dcls, input_dcls, other_dcls, env} =
24 :     CheckGlobals.check (env, cxt, globals)
25 : jhr 3432 val init' = (case init
26 :     of SOME stm => (
27 :     E.recordProp (env, Properties.GlobalInit);
28 :     SOME(CheckStmt.check(E.initScope env, cxt, stm)))
29 : jhr 3410 | NONE => NONE
30 :     (* end case *))
31 :     val (strand', env) = CheckStrand.check (env, cxt, strand)
32 :     val create' = CheckCreate.check (env, cxt, create)
33 : jhr 3402 val update' = (case update
34 : jhr 3432 of SOME stm => (
35 :     E.recordProp(env, Properties.GlobalUpdate);
36 :     SOME(CheckStmt.check(E.updateScope env, cxt, stm)))
37 : jhr 3402 | NONE => NONE
38 :     (* end case *))
39 : jhr 3413 val prog = AST.Program{
40 :     props = E.properties env,
41 :     const_dcls = const_dcls,
42 :     input_dcls = input_dcls,
43 :     globals = other_dcls,
44 :     strand = strand',
45 :     init = init',
46 :     create = create',
47 :     update = update'
48 :     }
49 : jhr 3401 in
50 : jhr 3413 CheckVarUses.check (cxt, prog);
51 :     prog
52 : jhr 3401 end
53 :    
54 :     end

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