summaryrefslogtreecommitdiff
path: root/fp2/week45/camil/RefactorX.dcl
diff options
context:
space:
mode:
authorCamil Staps2015-05-18 14:47:30 +0200
committerCamil Staps2015-05-18 14:47:30 +0200
commit655114600f02bd2d0ed5571cdb1670b357b3fa41 (patch)
treee66debb5c5ce7949cb4faa1e4847f6ecd5a8a536 /fp2/week45/camil/RefactorX.dcl
parentsmall update fix (diff)
RefactorX camil
Diffstat (limited to 'fp2/week45/camil/RefactorX.dcl')
-rw-r--r--fp2/week45/camil/RefactorX.dcl18
1 files changed, 18 insertions, 0 deletions
diff --git a/fp2/week45/camil/RefactorX.dcl b/fp2/week45/camil/RefactorX.dcl
new file mode 100644
index 0000000..3ddc8a4
--- /dev/null
+++ b/fp2/week45/camil/RefactorX.dcl
@@ -0,0 +1,18 @@
+definition module RefactorX
+
+import StdEnv
+
+:: Expr = NR Int
+ | VAR Name
+ | OP Expr Operator Expr
+ | LET Name Expr Expr
+:: Name :== String
+:: Operator = PLUS | MIN | MUL | DIV
+:: Val = Result Int | Undef
+
+from StdClass import class toString
+
+instance toString Expr
+free :: Expr -> [Name]
+remove_unused_lets :: Expr -> Expr
+eval :: Expr -> Val