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

SCM Repository

[diderot] Diff of /trunk/src/compiler/fields/field-def.sml
ViewVC logotype

Diff of /trunk/src/compiler/fields/field-def.sml

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

revision 243, Fri Aug 6 15:27:47 2010 UTC revision 244, Fri Aug 6 15:31:13 2010 UTC
# Line 15  Line 15 
15        | SUM of field_def * field_def        | SUM of field_def * field_def
16  (* scaling too? *)  (* scaling too? *)
17    
18      (* slightly smart constructor for DIFF *)
19        fun diff (DIFF(k, fld)) = DIFF(k+1, fld)
20          | diff fld = DIFF(1, fld)
21    
22      (* slightly smart constructor for NEG *)
23        fun neg (NEG fld) = fld
24          | neg fld = (NEG fld)
25    
26    (* normalize a field definition by pushing the DIFF operators to the    (* normalize a field definition by pushing the DIFF operators to the
27     * leaves     * leaves
28     *)     *)
# Line 22  Line 30 
30            fun norm fld = (case fld            fun norm fld = (case fld
31                   of CONV _ => fld                   of CONV _ => fld
32                    | DIFF(k, fld) => diff (k, fld)                    | DIFF(k, fld) => diff (k, fld)
33                      | NEG(NEG fld) => norm fld
34                    | NEG fld => NEG(norm fld)                    | NEG fld => NEG(norm fld)
35                    | SUM(fld1, fld2) => SUM(norm fld1, norm fld2)                    | SUM(fld1, fld2) => SUM(norm fld1, norm fld2)
36                  (* end case *))                  (* end case *))
37            and diff (k, fld) = (case fld            and diff (k, fld) = (case fld
38                   of CONV _ => DIFF(k, fld)                   of CONV _ => DIFF(k, fld)
39                    | DIFF(k', fld) => diff (k+k', fld)                    | DIFF(k', fld) => diff (k+k', fld)
40                      | NEG(NEG fld) => norm fld
41                    | NEG fld => NEG(diff(k, fld))                    | NEG fld => NEG(diff(k, fld))
42                    | SUM(fld1, fld2) => SUM(diff(k, fld1), diff(k, fld2))                    | SUM(fld1, fld2) => SUM(diff(k, fld1), diff(k, fld2))
43                  (* end case *))                  (* end case *))

Legend:
Removed from v.243  
changed lines
  Added in v.244

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