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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/codegen/clang.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/codegen/clang.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 572, Tue Mar 1 15:34:03 2011 UTC revision 573, Thu Mar 3 17:43:19 2011 UTC
# Line 17  Line 17 
17      datatype ty      datatype ty
18        = T_Num of RawTypes.ty        = T_Num of RawTypes.ty
19        | T_Ptr of ty        | T_Ptr of ty
20        | T_Array of ty * int        | T_Array of ty * int option
21        | T_Named of string        | T_Named of string
22    
23      val voidTy = T_Named "void"      val voidTy = T_Named "void"
# Line 32  Line 32 
32      (* verbatim text (e.g., preprocessor directives) *)      (* verbatim text (e.g., preprocessor directives) *)
33        | D_Verbatim of string list        | D_Verbatim of string list
34      (* global variable declaration *)      (* global variable declaration *)
35        | D_Var of attr list * ty * var        | D_Var of attr list * ty * var * initializer option
36      (* function definition *)      (* function definition *)
37        | D_Func of attr list * ty * string * param list * stm        | D_Func of attr list * ty * string * param list * stm
38      (* typedef of struct type *)      (* typedef of struct type *)
39        | D_StructDef of (ty * string) list * string        | D_StructDef of (ty * string) list * string
40    
41        and initializer
42          = I_Exp of exp
43          | I_Struct of (string * initializer) list
44          | I_Array of (int * initializer) list
45    
46      and param = PARAM of attr list * ty * var      and param = PARAM of attr list * ty * var
47    
48      and stm      and stm
# Line 64  Line 69 
69        | E_Flt of FloatLit.float * ty        | E_Flt of FloatLit.float * ty
70        | E_Bool of bool        | E_Bool of bool
71        | E_Str of string        | E_Str of string
72          | E_Sizeof of ty                  (* "sizeof(" ty ")" *)
73    
74    (* binary operators in increasing order of precedence *)    (* binary operators in increasing order of precedence *)
75      and binop      and binop
# Line 118  Line 124 
124          | prec (E_Flt _) = atomP          | prec (E_Flt _) = atomP
125          | prec (E_Bool _) = atomP          | prec (E_Bool _) = atomP
126          | prec (E_Str _) = atomP          | prec (E_Str _) = atomP
127            | prec (E_Sizeof _) = callP
128      in      in
129      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
130    (* Note that all C binary operators are left associative. *)    (* Note that all C binary operators are left associative. *)
# Line 147  Line 154 
154      val mkFlt = E_Flt      val mkFlt = E_Flt
155      val mkBool = E_Bool      val mkBool = E_Bool
156      val mkStr = E_Str      val mkStr = E_Str
157        val mkSizeof = E_Sizeof
158      end (* local *)      end (* local *)
159    
160      val skip = S_Block[]      val skip = S_Block[]
# Line 215  Line 223 
223                  | E_Flt(f, _) => FloatLit.toString f :: l                  | E_Flt(f, _) => FloatLit.toString f :: l
224                  | E_Bool b => Bool.toString b :: l                  | E_Bool b => Bool.toString b :: l
225                  | E_Str s => concat["\"", String.toCString s, "\""] :: l                  | E_Str s => concat["\"", String.toCString s, "\""] :: l
226                    | E_Sizeof ty => "sizeof(ty)" :: l
227                (* end case *))                (* end case *))
228            in            in
229              String.concat(e2s(e, []))              String.concat(e2s(e, []))

Legend:
Removed from v.572  
changed lines
  Added in v.573

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