Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] View of /trunk/sml3d/src/particles/psys-ir.sml
ViewVC logotype

View of /trunk/sml3d/src/particles/psys-ir.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 498 - (download) (annotate)
Sun Oct 25 03:32:49 2009 UTC (9 years, 10 months ago) by pavelk
File size: 1340 byte(s)
Broke out particle IR into its own module.
(* psys-var.sml
 *
 * COPYRIGHT (c) 2009 John Reppy (http://cs.uchicago.edu/~jhr)
 * All rights reserved.
 *)

structure PSysIR :> PSYSIR =
  struct
    
    structure P = Particles
    structure PSV = PSysVar
  
    (******** Intermediate Representation *********)  
    datatype Primitive =
      (* Vector primitives *)
      ADD_VEC
      | SUB_VEC
      | LEN_SQ
      | LEN
      | SCALE
      | DOT
      | CROSS
      (* ... *)
  
      (* Scalar Primitives *)
      | ADD
      | SUB
      | MULT
      | DIV
      | SQRT
      (* ... *)
      
      (* Boolean Primitives *)
      | GREATERTHAN
      | EQUALS
      | AND
      | OR
      | NOT
      (* ... *)
    
    datatype VarScope =
      GLOBAL
      | LOCAL
      | CONST
      
    datatype VarType =
      VEC of Vec3f.vec3f
      | FLOAT of Float.float
      | BOOL of bool
      
    datatype Var = V of {
      name : string,
      id : int,
      varType : VarType,
      scope : VarScope
    }  
      
    datatype Stmt = 
        PRIM of Primitive * Var list (* Primitives with an argument list *)
      | IFTE of Stmt * Stmt * Stmt (* If then else *)
      | BLOCK of Stmt list (* Imperative list of statements *)
      | BINDING of string * Stmt (* Variable assignment *)
      
    (* IMPLEMENT ME! *)
    fun compile(psal, env) = BLOCK([])
  end (* PSysIR *)

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