20 |
| T_Array of ty * int |
| T_Array of ty * int |
21 |
| T_Named of string |
| T_Named of string |
22 |
|
|
23 |
|
val charPtr = T_Ptr(T_Num(RawTypes.RT_UInt8)) |
24 |
val int32 = T_Num(RawTypes.RT_Int32) |
val int32 = T_Num(RawTypes.RT_Int32) |
25 |
val int64 = T_Num(RawTypes.RT_Int64) |
val int64 = T_Num(RawTypes.RT_Int64) |
26 |
val float = T_Num(RawTypes.RT_Float) |
val float = T_Num(RawTypes.RT_Float) |
56 |
| E_Int of IntegerLit.integer * ty |
| E_Int of IntegerLit.integer * ty |
57 |
| E_Flt of FloatLit.float * ty |
| E_Flt of FloatLit.float * ty |
58 |
| E_Bool of bool |
| E_Bool of bool |
59 |
|
| E_Str of string |
60 |
|
|
61 |
(* binary operators in increasing order of precedence *) |
(* binary operators in increasing order of precedence *) |
62 |
and binop |
and binop |
110 |
| prec (E_Int _) = atomP |
| prec (E_Int _) = atomP |
111 |
| prec (E_Flt _) = atomP |
| prec (E_Flt _) = atomP |
112 |
| prec (E_Bool _) = atomP |
| prec (E_Bool _) = atomP |
113 |
|
| prec (E_Str _) = atomP |
114 |
in |
in |
115 |
fun mkGrp e = if (prec e < atomP) then E_Grp e else e |
fun mkGrp e = if (prec e < atomP) then E_Grp e else e |
116 |
(* Note that all C binary operators are left associative. *) |
(* Note that all C binary operators are left associative. *) |
139 |
val mkInt = E_Int |
val mkInt = E_Int |
140 |
val mkFlt = E_Flt |
val mkFlt = E_Flt |
141 |
val mkBool = E_Bool |
val mkBool = E_Bool |
142 |
|
val mkStr = E_Str |
143 |
end (* local *) |
end (* local *) |
144 |
|
|
145 |
val skip = S_Block[] |
val skip = S_Block[] |
150 |
in |
in |
151 |
fun mkBlock [stm] = stm |
fun mkBlock [stm] = stm |
152 |
| mkBlock stms = S_Block stms |
| mkBlock stms = S_Block stms |
153 |
|
val mkDecl = S_Decl |
154 |
val mkAssign = S_Assign |
val mkAssign = S_Assign |
155 |
fun mkIfThenElse (e, b1, b2) = S_If(paren e, b1, b2) |
fun mkIfThenElse (e, b1, b2) = S_If(paren e, b1, b2) |
156 |
fun mkIfThen (e, b) = mkIfThenElse (e, b, skip) |
fun mkIfThen (e, b) = mkIfThenElse (e, b, skip) |