aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/ir-utils.stanza
diff options
context:
space:
mode:
authorazidar2015-07-06 17:45:06 -0700
committerazidar2015-07-14 11:29:55 -0700
commit68f7ac42d01c88bcc0c77c919587618673658c76 (patch)
tree054c3a2fdb710b187664fb9e7212046f12ec2ef2 /src/main/stanza/ir-utils.stanza
parent8d6c83072cd60ecc376d81eb9a48ccf0f67e57f6 (diff)
Still partial commit, many tests pass. Many tests fail.
Diffstat (limited to 'src/main/stanza/ir-utils.stanza')
-rw-r--r--src/main/stanza/ir-utils.stanza26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza
index e29bf4ac..8e65005f 100644
--- a/src/main/stanza/ir-utils.stanza
+++ b/src/main/stanza/ir-utils.stanza
@@ -98,7 +98,15 @@ defmethod print (o:OutputStream, d:Flip) :
DEFAULT : ""
REVERSE: "flip"
-defmethod print (o:OutputStream, d:Direction) :
+defmethod print (o:OutputStream, d:AccDirection) :
+ print{o, _} $
+ switch {d == _} :
+ READ : "read"
+ WRITE: "write"
+ INFER: "infer"
+ RDWR: "rdwr"
+
+defmethod print (o:OutputStream, d:PortDirection) :
print{o, _} $
switch {d == _} :
INPUT : "input"
@@ -177,12 +185,16 @@ defmethod print (o:OutputStream, c:Stmt) :
(c:DefNode) :
print-all(o,["node " name(c) " = " value(c)])
(c:DefAccessor) :
- print-all(o,["accessor " name(c) " = " source(c) "[" index(c) "]"])
+ print-all(o,[acc-dir(c) " accessor " name(c) " = " source(c) "[" index(c) "]"])
(c:Conditionally) :
- print-all(o, ["when " pred(c) " :"])
- print-debug(o,c)
- print(o,"\n")
- print(io,conseq(c))
+ if conseq(c) typeof Begin :
+ print-all(o, ["when " pred(c) " :"])
+ print-debug(o,c)
+ print(o,"\n")
+ print(io,conseq(c))
+ else :
+ print-all(o, ["when " pred(c) " : " conseq(c)])
+ print-debug(o,c)
if alt(c) not-typeof EmptyStmt :
print(o, "\nelse :")
print(io, "\n")
@@ -277,7 +289,7 @@ defmethod map (f: Expression -> Expression, e:Expression) -> Expression :
public defmulti map<?T> (f: Expression -> Expression, c:?T&Stmt) -> T
defmethod map (f: Expression -> Expression, c:Stmt) -> Stmt :
match(c) :
- (c:DefAccessor) : DefAccessor(info(c),name(c), f(source(c)), f(index(c)))
+ (c:DefAccessor) : DefAccessor(info(c),name(c), f(source(c)), f(index(c)),acc-dir(c))
(c:DefNode) : DefNode(info(c),name(c), f(value(c)))
(c:DefInstance) : DefInstance(info(c),name(c), f(module(c)))
(c:Conditionally) : Conditionally(info(c),f(pred(c)), conseq(c), alt(c))