diff options
author | rustanleino <unknown> | 2009-08-16 02:01:51 +0000 |
---|---|---|
committer | rustanleino <unknown> | 2009-08-16 02:01:51 +0000 |
commit | a4c54c653955471759da6adf28f8d6bac84bec1f (patch) | |
tree | c66b37ef0f8854fe581a078d5e4ca4aa1071bf59 /Chalice/src/PrettyPrinter.scala | |
parent | 3bd44c8d3a6780bbeea6bfedfe09732b83215271 (diff) |
* Implemented channels
- channel declarations
- send and receive statements
- bounds clause for new, to accommodate channels
- Added ProdConsChannel.chalice test case
- Resolve and Translate (but no Compile yet)
- Added Credits to global state in encoding (this caused changes to lots of source lines)
* Simplified meaning of maxlock==E
* Various parser improvements
* Added alternative syntax for eval statements
* Some renamings in error messages (e.g., install -> reorder)
* Added preliminary parsing for condition variables and their wait and signal operations
* Added new keywords to Chalice emacs mode
Diffstat (limited to 'Chalice/src/PrettyPrinter.scala')
-rw-r--r-- | Chalice/src/PrettyPrinter.scala | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Chalice/src/PrettyPrinter.scala b/Chalice/src/PrettyPrinter.scala index 32cf0e15..fb94f711 100644 --- a/Chalice/src/PrettyPrinter.scala +++ b/Chalice/src/PrettyPrinter.scala @@ -148,6 +148,15 @@ object PrintProgram { print("signal "); if (all) { print(" forall") }
MemberSelect(obj, id, 0, false)
println(Semi)
+ case Send(ch, args) =>
+ print("send "); Expr(ch); print("("); ExprList(args); print(")"); println(Semi)
+ case Receive(ch, outs) =>
+ print("receive ")
+ outs match {
+ case Nil =>
+ case x :: xs => Expr(x); xs foreach { x => print(", "); Expr(x) }; print(" := ")
+ }
+ Expr(ch); println(Semi)
}
def PrintBounds(lower: List[Expression], upper: List[Expression]) = {
if (lower == Nil && upper == Nil) {
@@ -177,11 +186,12 @@ object PrintProgram { rest foreach { e => print(", "); Expr(e) }
}
def Rhs(e: RValue) = e match {
- case NewRhs(id, initialization) =>
+ case NewRhs(id, initialization, lower, upper) =>
print("new " + id);
if(0 < initialization.length) {
print(" {"); print(initialization(0).id); print(":="); Expr(initialization(0).e); initialization.foreach({ init => print(", "); print(init.id); print(":="); Expr(init.e); }); print("}");
}
+ PrintBounds(lower, upper)
case e: Expression => Expr(e)
}
def Expr(e: Expression): Unit = Expr(e, 0, false)
@@ -217,6 +227,10 @@ object PrintProgram { case Some(None) => print(", *)")
case Some(Some(e)) => print(", "); Expr(e); print(")")
}
+ case Credit(e, n) =>
+ print("credit("); Expr(e)
+ n match { case None => case Some(n) => print(", "); Expr(n) }
+ print(")")
case Holds(e) =>
print("holds("); Expr(e); print(")")
case RdHolds(e) =>
|