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 4327 - (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 : jhr 4327 val globInit' = Option.map
26 :     (fn stm => CheckStmt.check (E.initScope env, cxt, stm)) globInit
27 : jhr 4317 val (strand', env) = CheckStrand.check (env, cxt, strand)
28 :     val create' = CheckCreate.check (env, cxt, create)
29 :     val init' = (case init
30 :     of SOME stm => (
31 :     E.recordProp (env, Properties.GlobalInitially);
32 : jhr 4327 SOME(CheckStmt.check(E.initiallyScope env, cxt, stm)))
33 : jhr 4317 | NONE => NONE
34 :     (* end case *))
35 :     val update' = (case update
36 :     of SOME stm => (
37 :     E.recordProp(env, Properties.GlobalUpdate);
38 :     SOME(CheckStmt.check(E.updateScope env, cxt, stm)))
39 :     | NONE => NONE
40 :     (* end case *))
41 :     val prog = AST.Program{
42 :     props = E.properties env,
43 :     const_dcls = const_dcls,
44 :     input_dcls = input_dcls,
45 :     globals = other_dcls,
46 :     globInit = globInit',
47 :     strand = strand',
48 :     create = create',
49 :     init = init',
50 :     update = update'
51 :     }
52 : jhr 3401 in
53 : jhr 3413 CheckVarUses.check (cxt, prog);
54 : jhr 4317 prog
55 : jhr 3401 end
56 :    
57 :     end

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