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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4131 - (download) (annotate)
Fri Jul 1 12:59:23 2016 UTC (3 years, 3 months ago) by jhr
File size: 1601 byte(s)
working on merge
(* typechecker.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *)

structure Typechecker : sig

  (* type check a Diderot program *)
    val check : Error.err_stream -> ParseTree.program -> AST.program

  end = struct

    structure PT = ParseTree
    structure E = Env

    fun check errStrm (PT.Program{span, tree}) = let
	  val {globals, globInit, strand, init, create, update} = tree
          val cxt = (errStrm, span)
          val env = E.new()
	  val {const_dcls, input_dcls, other_dcls, env} =
		CheckGlobals.check (env, cxt, globals)
	  val globInit' = Option.map (fn stm => CheckStmt.check (env, cxt, stm)) globInit
	  val (strand', env) = CheckStrand.check (env, cxt, strand)
	  val create' = CheckCreate.check (env, cxt, create)
	  val init' = (case init
		 of SOME stm => (
		      E.recordProp (env, Properties.GlobalInitially);
		      SOME(CheckStmt.check(E.initScope env, cxt, stm)))
		  | NONE => NONE
		(* end case *))
	  val update' = (case update
		 of SOME stm => (
		      E.recordProp(env, Properties.GlobalUpdate);
		      SOME(CheckStmt.check(E.updateScope env, cxt, stm)))
		  | NONE => NONE
		(* end case *))
	  val prog = AST.Program{
		  props = E.properties env,
		  const_dcls = const_dcls,
		  input_dcls = input_dcls,
		  globals = other_dcls,
		  globInit = globInit',
		  strand = strand',
		  create = create',
		  init = init',
		  update = update'
		}
          in
            CheckVarUses.check (cxt, prog);
	    prog
          end

  end

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