Permalink
Browse files

instantiation

  • Loading branch information...
1 parent 803d2da commit d26aa3c682750883a4701a1c1530d3510f2a5895 @mmikulicic committed Jan 4, 2010
Showing with 14 additions and 4 deletions.
  1. +4 −1 src/ast.clj
  2. +10 −3 src/doroty.clj
View
@@ -10,4 +10,7 @@
{:type 'Ref :name n})
(defn make-struct-def [l v]
- {:type 'StructDef :label l :value v})
+ {:type 'StructDef :label l :value v})
+
+(defn make-instantiation [set args]
+ {:type 'Inst :set set :args args})
View
@@ -17,8 +17,8 @@
(def structureDef
(let-bind [label identifier
- _ (symb "=")
- val expression]
+ _ (symb "=")
+ val expression]
(result (make-struct-def label val))))
(def structure
@@ -27,7 +27,14 @@
(def literal
(either structure number stringLit reference))
+(def argList
+ (sepBy expression comma))
+(def instantiation
+ (let-bind [_ (symb "new")
+ set identifier
+ args (parens argList)]
+ (result (make-instantiation set args))))
(def predecl
@@ -37,7 +44,7 @@
(string "ugo"))
(def expression
- literal)
+ (either instantiation literal))
(def statement

0 comments on commit d26aa3c

Please sign in to comment.