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

SCM Repository

[diderot] View of /branches/pure-cfg/src/compiler/tree-il/tree-il.sml
ViewVC logotype

View of /branches/pure-cfg/src/compiler/tree-il/tree-il.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 529 - (download) (annotate)
Mon Feb 14 15:03:54 2011 UTC (8 years, 9 months ago) by jhr
Original Path: branches/pure-cfg/src/compiler/codegen/tree-il.sml
File size: 1402 byte(s)
  Working on code generation
(* tree-il.sml
 *
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * This representation restores the block structure and nested expression syntax
 * of the source language.
 *)

structure TreeIL =
  struct

    structure Op = LowOps

    datatype program = Program of {
	globals : var list,
	globalInit : stm,
	strands : strand list
	(* initialization *)
      }

    and strand = Strand of {
	name : Atom.atom,
	params : var list,
	state : var list,
	stateInit : stm,
	methods : method list
      }

    and method = Method of {
	name : Atom.atom,
	body : stm		(* method body *)
      }

    and block = Block of {
	locals : var list,
	body : stm list
      }

    and stm
      = S_Comment of string list
      | S_Assign of var * exp
      | S_IfThen of var * block
      | S_IfThenElse of var * block * block
      | S_Die
      | S_Stabilize

    and exp
      = E_Var of var
      | E_Lit of Literal.literal
      | E_Op of Op.rator * exp list
      | E_Cons of exp list		(* tensor-value construction *)

    and var = V of {
	name : string,			(* name (should be unique) *)
	id : Stamp.stamp,		(* unique ID *)
	kind : var_kind,
	ty : Ty.ty			(* type *)
      }

    and kind
      = VK_Global			(* global variable *)
      | VK_State of strand		(* strand state variable *)
      | VK_Local			(* includes strand parameters *)

  end

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