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

SCM Repository

[diderot] Diff of /trunk/src/compiler/IL/expr-fn.sml
ViewVC logotype

Diff of /trunk/src/compiler/IL/expr-fn.sml

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

revision 435, Tue Oct 19 13:14:20 2010 UTC revision 1116, Thu May 5 04:49:02 2011 UTC
# Line 16  Line 16 
16      datatype expr_nd      datatype expr_nd
17        = VAR of IL.var        = VAR of IL.var
18        | LIT of Literal.literal        | LIT of Literal.literal
19        | APP of Op.rator * expr list        | OP of Op.rator * expr list
20        | CONS of expr list        | APPLY of ILBasis.name * expr list
21          | CONS of IL.Ty.ty * expr list
22    
23      withtype expr = expr_nd HashCons.obj      withtype expr = expr_nd HashCons.obj
24    
# Line 29  Line 30 
30      val mkVAR  : tbl -> IL.var -> expr      val mkVAR  : tbl -> IL.var -> expr
31      val mkLIT  : tbl -> Literal.literal -> expr      val mkLIT  : tbl -> Literal.literal -> expr
32      val mkAPP  : tbl -> Op.rator * expr list -> expr      val mkAPP  : tbl -> Op.rator * expr list -> expr
33      val mkCONS : tbl -> expr list -> expr      val mkCONS : tbl -> IL.Ty.ty * expr list -> expr
34    
35    (* tables, sets, and maps *)    (* tables, sets, and maps *)
36      structure Tbl : MONO_HASH_TABLE where type Key.hash_key = expr      structure Tbl : MONO_HASH_TABLE where type Key.hash_key = expr
# Line 48  Line 49 
49      datatype expr_nd      datatype expr_nd
50        = VAR of IL.var        = VAR of IL.var
51        | LIT of Literal.literal        | LIT of Literal.literal
52        | APP of Op.rator * expr list        | OP of Op.rator * expr list
53        | CONS of expr list        | APPLY of ILBasis.name * expr list
54          | CONS of IL.Ty.ty * expr list
55    
56      withtype expr = expr_nd HashCons.obj      withtype expr = expr_nd HashCons.obj
57    
# Line 58  Line 60 
60    
61      fun sameNd (VAR x, VAR y) = IL.Var.same(x, y)      fun sameNd (VAR x, VAR y) = IL.Var.same(x, y)
62        | sameNd (LIT a, LIT b) = Literal.same(a, b)        | sameNd (LIT a, LIT b) = Literal.same(a, b)
63        | sameNd (APP(op1, args1), APP(op2, args2)) =        | sameNd (OP(op1, args1), OP(op2, args2)) =
64            Op.same(op1, op2) andalso same'(args1, args2)            Op.same(op1, op2) andalso same'(args1, args2)
65        | sameNd (CONS args1, CONS args2) = same'(args1, args2)        | sameNd (CONS args1, CONS args2) = same'(args1, args2)
66        | sameNd _ = false        | sameNd _ = false
# Line 71  Line 73 
73      fun mkVAR (Tbl tbl) x = HC.cons0 tbl (0w7919 + IL.Var.hash x, VAR x)      fun mkVAR (Tbl tbl) x = HC.cons0 tbl (0w7919 + IL.Var.hash x, VAR x)
74      fun mkLIT (Tbl tbl) a = HC.cons0 tbl (0w6997 + Literal.hash a, LIT a)      fun mkLIT (Tbl tbl) a = HC.cons0 tbl (0w6997 + Literal.hash a, LIT a)
75      fun mkAPP (Tbl tbl) (rator, args) =      fun mkAPP (Tbl tbl) (rator, args) =
76            HC.consList tbl (Op.hash rator, fn args => APP(rator, args)) args            HC.consList tbl (Op.hash rator, fn args => OP(rator, args)) args
77        fun mkAPP (Tbl tbl) (rator, args) =
78              HC.consList tbl (Op.hash rator, fn args => OP(rator, args)) args
79      fun mkCONS (Tbl tbl) args = HC.consList tbl (0w5987, CONS) args      fun mkCONS (Tbl tbl) args = HC.consList tbl (0w5987, CONS) args
80    
81    (* hash tables *)    (* hash tables *)

Legend:
Removed from v.435  
changed lines
  Added in v.1116

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