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 3410 - (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 3410 val init' = (case update
26 :     of SOME stm => SOME(CheckStmt.check(E.initScope env, cxt, stm))
27 :     | NONE => NONE
28 :     (* end case *))
29 :     val (strand', env) = CheckStrand.check (env, cxt, strand)
30 :     val create' = CheckCreate.check (env, cxt, create)
31 : jhr 3402 val update' = (case update
32 : jhr 3410 of SOME stm => SOME(CheckStmt.check(E.updateScope env, cxt, stm))
33 : jhr 3402 | NONE => NONE
34 :     (* end case *))
35 : jhr 3401 in
36 :     AST.Program{
37 : jhr 3410 props = E.properties env,
38 : jhr 3409 const_dcls = const_dcls,
39 :     input_dcls = input_dcls,
40 :     globals = other_dcls,
41 : jhr 3401 strand = strand',
42 :     init = init',
43 :     create = create',
44 :     update = update'
45 :     }
46 : jhr 3410 (* TODO: uninitialized and unused variable check *)
47 : jhr 3401 end
48 :    
49 :     end

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