11 |
|
|
12 |
type program |
type program |
13 |
type strand |
type strand |
14 |
|
type var |
15 |
type exp |
type exp |
16 |
type cond |
type cond |
17 |
type stm |
type stm |
18 |
type method |
type method |
19 |
|
|
20 |
val defineStrand : program * ?? -> strand |
val defineStrand : program * string -> strand |
21 |
val globalVar : program * ?? -> global_var |
val tmpVar : unit -> var |
22 |
val stateVar : strand * ?? -> state_var |
|
23 |
|
structure Var : sig |
24 |
|
val global : program * string -> var |
25 |
|
val state : strand * string -> var |
26 |
|
val tmpVar : unit -> var |
27 |
|
end |
28 |
|
|
29 |
(* expression construction *) |
(* expression construction *) |
30 |
structure Expr : sig |
structure Expr : sig |
31 |
(* variable references *) |
(* variable references *) |
32 |
val global : global_var -> exp |
val global : var -> exp |
33 |
val getState : state_var -> exp |
val getState : var -> exp |
34 |
val param : param_var -> exp |
val param : var -> exp |
35 |
val var : local_var -> exp |
val var : var -> exp |
36 |
(* literals *) |
(* literals *) |
37 |
val intLit : IntegerLit.integer -> exp |
val intLit : IntegerLit.integer -> exp |
38 |
val floatLit : FloatLit.float -> exp |
val floatLit : FloatLit.float -> exp |
41 |
(* vector construction *) |
(* vector construction *) |
42 |
val vector : exp list -> exp |
val vector : exp list -> exp |
43 |
(* select from a vector *) |
(* select from a vector *) |
44 |
val select : int * vector -> exp |
val select : int * exp -> exp |
45 |
(* vector (and scalar) arithmetic *) |
(* vector (and scalar) arithmetic *) |
46 |
val add : exp * exp -> exp |
val add : exp * exp -> exp |
47 |
val mul : exp * exp -> exp |
val mul : exp * exp -> exp |
49 |
val divide : exp * exp -> exp |
val divide : exp * exp -> exp |
50 |
val neg : exp -> exp |
val neg : exp -> exp |
51 |
val abs : exp -> exp |
val abs : exp -> exp |
52 |
val dot : exp * expr -> exp (* dot product *) |
val dot : exp * exp -> exp (* dot product *) |
53 |
val cross : exp * exp -> exp (* cross product *) |
val cross : exp * exp -> exp (* cross product *) |
54 |
val length : exp -> exp (* vector length *) |
val length : exp -> exp (* vector length *) |
55 |
val normalize : exp -> exp (* normalize vector *) |
val normalize : exp -> exp (* normalize vector *) |
61 |
val sin : exp -> exp |
val sin : exp -> exp |
62 |
val cos : exp -> exp |
val cos : exp -> exp |
63 |
val sqrt : exp -> exp |
val sqrt : exp -> exp |
64 |
|
(* rounding *) |
65 |
|
val round : exp -> exp (* round real to integral real *) |
66 |
|
val floor : exp -> exp (* round real to integral real *) |
67 |
|
val ceil : exp -> exp (* round real to integral real *) |
68 |
(* conversions *) |
(* conversions *) |
69 |
val toReal : exp -> exp (* integer to real *) |
val toReal : exp -> exp (* integer to real *) |
70 |
val roundToInt : exp -> exp (* round real to int *) |
val roundToInt : exp -> exp (* round real to int *) |
75 |
|
|
76 |
(* conditionals *) |
(* conditionals *) |
77 |
structure Cond : sig |
structure Cond : sig |
78 |
|
val var : var -> cond |
79 |
(* comparisons *) |
(* comparisons *) |
80 |
val lt : exp * exp -> cond |
val lt : exp * exp -> cond |
81 |
val lte : exp * exp -> cond |
val lte : exp * exp -> cond |
92 |
(* statement construction *) |
(* statement construction *) |
93 |
structure Stmt : sig |
structure Stmt : sig |
94 |
val comment : string list -> stm |
val comment : string list -> stm |
95 |
val assignState : state_var * exp -> stm |
val assignState : var * exp -> stm |
96 |
val assign : local_var * exp -> stm |
val assign : var * exp -> stm |
97 |
|
val assignb : var * cond -> stm |
98 |
val block : stm list -> stm |
val block : stm list -> stm |
99 |
val ifthenelse : cond * stm * stm -> stm |
val ifthenelse : cond * stm * stm -> stm |
100 |
val die : unit -> stm |
val die : unit -> stm |