Created
August 29, 2015 11:38
-
-
Save retronym/953f544e419d461eaa62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% qscalac -Xprint:parser,patmat sandbox/test1.scala | |
[[syntax trees at end of parser]] // test1.scala | |
package <empty> { | |
sealed abstract class Expr extends scala.AnyRef { | |
def <init>() = { | |
super.<init>(); | |
() | |
} | |
}; | |
case class Mul extends Expr with scala.Product with scala.Serializable { | |
<caseaccessor> <paramaccessor> val a: Expr = _; | |
<caseaccessor> <paramaccessor> val b: Expr = _; | |
def <init>(a: Expr, b: Expr) = { | |
super.<init>(); | |
() | |
} | |
}; | |
case class Num extends Expr with scala.Product with scala.Serializable { | |
<caseaccessor> <paramaccessor> val i: Int = _; | |
def <init>(i: Int) = { | |
super.<init>(); | |
() | |
} | |
}; | |
class Test extends scala.AnyRef { | |
def <init>() = { | |
super.<init>(); | |
() | |
}; | |
def simplify(e: Expr): Expr = e match { | |
case Mul((x @ _), Num(1)) => x | |
case Mul(Num(1), (x @ _)) => x | |
case Mul(Num(0), _) => Num(0) | |
case Mul(_, Num(0)) => Num(0) | |
case _ => e | |
} | |
} | |
} | |
[[syntax trees at end of patmat]] // test1.scala | |
package <empty> { | |
sealed abstract class Expr extends scala.AnyRef { | |
def <init>(): Expr = { | |
Expr.super.<init>(); | |
() | |
} | |
}; | |
case class Mul extends Expr with Product with Serializable { | |
<caseaccessor> <paramaccessor> private[this] val a: Expr = _; | |
<stable> <caseaccessor> <accessor> <paramaccessor> def a: Expr = Mul.this.a; | |
<caseaccessor> <paramaccessor> private[this] val b: Expr = _; | |
<stable> <caseaccessor> <accessor> <paramaccessor> def b: Expr = Mul.this.b; | |
def <init>(a: Expr, b: Expr): Mul = { | |
Mul.super.<init>(); | |
() | |
}; | |
<synthetic> def copy(a: Expr = a, b: Expr = b): Mul = new Mul(a, b); | |
<synthetic> def copy$default$1: Expr = Mul.this.a; | |
<synthetic> def copy$default$2: Expr = Mul.this.b; | |
override <synthetic> def productPrefix: String = "Mul"; | |
<synthetic> def productArity: Int = 2; | |
<synthetic> def productElement(x$1: Int): Any = { | |
case <synthetic> val x1: Int = x$1; | |
x1 match { | |
case 0 => Mul.this.a | |
case 1 => Mul.this.b | |
case _ => throw new IndexOutOfBoundsException(x$1.toString()) | |
} | |
}; | |
override <synthetic> def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Mul.this); | |
<synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Mul](); | |
override <synthetic> def hashCode(): Int = ScalaRunTime.this._hashCode(Mul.this); | |
override <synthetic> def toString(): String = ScalaRunTime.this._toString(Mul.this); | |
override <synthetic> def equals(x$1: Any): Boolean = Mul.this.eq(x$1.asInstanceOf[Object]).||({ | |
case <synthetic> val x1: Any = x$1; | |
case5(){ | |
if (x1.isInstanceOf[Mul]) | |
matchEnd4(true) | |
else | |
case6() | |
}; | |
case6(){ | |
matchEnd4(false) | |
}; | |
matchEnd4(x: Boolean){ | |
x | |
} | |
}.&&({ | |
<synthetic> val Mul$1: Mul = x$1.asInstanceOf[Mul]; | |
Mul.this.a.==(Mul$1.a).&&(Mul.this.b.==(Mul$1.b)).&&(Mul$1.canEqual(Mul.this)) | |
})) | |
}; | |
<synthetic> object Mul extends scala.runtime.AbstractFunction2[Expr,Expr,Mul] with Serializable { | |
def <init>(): Mul.type = { | |
Mul.super.<init>(); | |
() | |
}; | |
final override <synthetic> def toString(): String = "Mul"; | |
case <synthetic> def apply(a: Expr, b: Expr): Mul = new Mul(a, b); | |
case <synthetic> def unapply(x$0: Mul): Option[(Expr, Expr)] = if (x$0.==(null)) | |
scala.this.None | |
else | |
Some.apply[(Expr, Expr)](scala.Tuple2.apply[Expr, Expr](x$0.a, x$0.b)); | |
<synthetic> private def readResolve(): Object = Mul | |
}; | |
case class Num extends Expr with Product with Serializable { | |
<caseaccessor> <paramaccessor> private[this] val i: Int = _; | |
<stable> <caseaccessor> <accessor> <paramaccessor> def i: Int = Num.this.i; | |
def <init>(i: Int): Num = { | |
Num.super.<init>(); | |
() | |
}; | |
<synthetic> def copy(i: Int = i): Num = new Num(i); | |
<synthetic> def copy$default$1: Int = Num.this.i; | |
override <synthetic> def productPrefix: String = "Num"; | |
<synthetic> def productArity: Int = 1; | |
<synthetic> def productElement(x$1: Int): Any = { | |
case <synthetic> val x1: Int = x$1; | |
x1 match { | |
case 0 => Num.this.i | |
case _ => throw new IndexOutOfBoundsException(x$1.toString()) | |
} | |
}; | |
override <synthetic> def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Num.this); | |
<synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Num](); | |
override <synthetic> def hashCode(): Int = { | |
<synthetic> var acc: Int = -889275714; | |
acc = Statics.this.mix(acc, i); | |
Statics.this.finalizeHash(acc, 1) | |
}; | |
override <synthetic> def toString(): String = ScalaRunTime.this._toString(Num.this); | |
override <synthetic> def equals(x$1: Any): Boolean = Num.this.eq(x$1.asInstanceOf[Object]).||({ | |
case <synthetic> val x1: Any = x$1; | |
case5(){ | |
if (x1.isInstanceOf[Num]) | |
matchEnd4(true) | |
else | |
case6() | |
}; | |
case6(){ | |
matchEnd4(false) | |
}; | |
matchEnd4(x: Boolean){ | |
x | |
} | |
}.&&({ | |
<synthetic> val Num$1: Num = x$1.asInstanceOf[Num]; | |
Num.this.i.==(Num$1.i).&&(Num$1.canEqual(Num.this)) | |
})) | |
}; | |
<synthetic> object Num extends scala.runtime.AbstractFunction1[Int,Num] with Serializable { | |
def <init>(): Num.type = { | |
Num.super.<init>(); | |
() | |
}; | |
final override <synthetic> def toString(): String = "Num"; | |
case <synthetic> def apply(i: Int): Num = new Num(i); | |
case <synthetic> def unapply(x$0: Num): Option[Int] = if (x$0.==(null)) | |
scala.this.None | |
else | |
Some.apply[Int](x$0.i); | |
<synthetic> private def readResolve(): Object = Num | |
}; | |
class Test extends scala.AnyRef { | |
def <init>(): Test = { | |
Test.super.<init>(); | |
() | |
}; | |
def simplify(e: Expr): Expr = { | |
<synthetic> var rc25: Boolean = false; | |
<synthetic> var x2: Mul = null.asInstanceOf[Mul]; | |
{ | |
case <synthetic> val x1: Expr = e; | |
case27(){ | |
if (x1.isInstanceOf[Mul]) | |
{ | |
rc25 = true; | |
x2 = (x1.asInstanceOf[Mul]: Mul); | |
{ | |
val x: Expr = x2.a; | |
<synthetic> val p3: Expr = x2.b; | |
if (p3.isInstanceOf[Num]) | |
{ | |
<synthetic> val x4: Num = (p3.asInstanceOf[Num]: Num); | |
{ | |
<synthetic> val p5: Int = x4.i; | |
if (1.==(p5)) | |
matchEnd26(x) | |
else | |
case28() | |
} | |
} | |
else | |
case28() | |
} | |
} | |
else | |
case28() | |
}; | |
case28(){ | |
if (rc25) | |
{ | |
<synthetic> val p7: Expr = x2.a; | |
val x: Expr = x2.b; | |
if (p7.isInstanceOf[Num]) | |
{ | |
<synthetic> val x8: Num = (p7.asInstanceOf[Num]: Num); | |
{ | |
<synthetic> val p9: Int = x8.i; | |
if (1.==(p9)) | |
matchEnd26(x) | |
else | |
case29() | |
} | |
} | |
else | |
case29() | |
} | |
else | |
case29() | |
}; | |
case29(){ | |
if (rc25) | |
{ | |
<synthetic> val p11: Expr = x2.a; | |
if (p11.isInstanceOf[Num]) | |
{ | |
<synthetic> val x13: Num = (p11.asInstanceOf[Num]: Num); | |
{ | |
<synthetic> val p14: Int = x13.i; | |
if (0.==(p14)) | |
matchEnd26(Num.apply(0)) | |
else | |
case30() | |
} | |
} | |
else | |
case30() | |
} | |
else | |
case30() | |
}; | |
case30(){ | |
if (rc25) | |
{ | |
<synthetic> val p17: Expr = x2.b; | |
if (p17.isInstanceOf[Num]) | |
{ | |
<synthetic> val x18: Num = (p17.asInstanceOf[Num]: Num); | |
{ | |
<synthetic> val p19: Int = x18.i; | |
if (0.==(p19)) | |
matchEnd26(Num.apply(0)) | |
else | |
case31() | |
} | |
} | |
else | |
case31() | |
} | |
else | |
case31() | |
}; | |
case31(){ | |
matchEnd26(e) | |
}; | |
matchEnd26(x: Expr){ | |
x | |
} | |
} | |
} | |
} | |
} | |
stty: tcsetattr: Interrupted system call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment