SCM Repository
View of /trunk/src/compiler/ast/ast.sml
Parent Directory
|
Revision Log
Revision 171 -
(download)
(annotate)
Sat Jul 24 14:13:10 2010 UTC (10 years, 6 months ago) by jhr
File size: 1942 byte(s)
Sat Jul 24 14:13:10 2010 UTC (10 years, 6 months ago) by jhr
File size: 1942 byte(s)
Adding simple-ast representation
(* ast.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. * * A typed abstract-syntax tree representation of Diderot programs. *) structure AST = struct structure Ty = Types (* AST variable kinds *) datatype var_kind = BasisVar | InputVar | GlobalVar | ActorParam (* parameter to actor definition *) | ActorStateVar (* actor state variable *) | ActorOutputVar (* actor output variable *) | LocalVar (* local variable in method *) datatype var = V of { name : string, (* print name of variable *) id : Stamp.stamp, (* unique ID *) kind : var_kind, (* variable kind *) ty : Ty.scheme (* type scheme *) } datatype program = Program of decl list and decl = D_Input of var * expr option | D_Var of var_decl (* global variable decl *) | D_Actor of { (* actor decl *) name : Atom.atom, params : var list, state : var_decl list, (* true marks output variables *) methods : method list } | D_InitialArray of create * iter list | D_InitialCollection of create * iter list and var_decl = VD_Decl of var * expr and method = M_Method of Atom.atom * stmt and create = C_Create of (Atom.atom * expr list) and iter = I_Range of var * expr * expr and stmt = S_Block of stmt list | S_Decl of var_decl | S_IfThenElse of expr * stmt * stmt | S_Assign of var * expr | S_New of Atom.atom * expr list | S_Die | S_Stabilize and expr = E_Var of var | E_Lit of Literal.literal | E_Tuple of expr list | E_Apply of var * Ty.meta_var list * expr list * Ty.ty (* note: operators can be polymorphic, so we record the type arguments. *) | E_Cons of expr list (* tensor-value construction *) | E_Cond of expr * expr * expr end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |