Skip to content
Snippets Groups Projects
Commit 792cac27 authored by Philippe Suter's avatar Philippe Suter
Browse files

No commit message

No commit message
parent 36a65084
Branches
Tags
No related merge requests found
......@@ -12,6 +12,13 @@ object Trees {
override def toString: String = PrettyPrinter(this)
}
/* Like vals */
case class Let(binder: Identifier, expression: Expr) extends Expr {
val et = expression.getType
if(et != NoType)
setType(et)
}
/* Control flow */
case class FunctionInvocation(funDef: FunDef, args: Seq[Expr]) extends Expr
case class IfExpr(cond: Expr, then: Expr, elze: Expr) extends Expr
......
......@@ -53,8 +53,11 @@ object RedBlack {
def makeBlack(t: Tree) = {
require(t != EmptyTree())
val Node(_, left, x, right) = t
Node(Black(), left, x, right)
//val Node(_, left, x, right) = t
//Node(Black(), left, x, right)
t match {
case Node(_, left, x, right) => Node(Black(), left, x, right)
}
} ensuring ((x:Tree) => x match {case Node(Black(), _, _, _) => true; case _ => false})
def ins_(t: Tree, e: Int): Tree = t match {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment