Skip to content

Commit 34ed356

Browse files
committed
starting point for alegbra synthesis
1 parent 61c70cd commit 34ed356

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package expression.extensions;
2+
import expression.Exp;
3+
import expression.data.BinaryExp;
4+
5+
6+
7+
public class Divd extends BinaryExp {
8+
9+
public Divd() {
10+
super();
11+
}
12+
}
13+
14+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package expression.operations;
2+
3+
import expression.extensions.SimplifyBase;
4+
5+
/**
6+
* Simplifies (x+0) -> x and (0+x) -> x and (0+0) -> 0
7+
* Also simplifies MULT
8+
*
9+
* TODO: Rename at some point
10+
*/
11+
public class SimplifyExpr extends SimplifyBase {
12+
public SimplifyExpr() {
13+
super();
14+
}
15+
}

src/main/scala/example/expression/algebra/Expression.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ class Expression @Inject()(webJars: WebJarsUtil, applicationLifecycle: Applicati
5454
var jobs = Gamma.InhabitationBatchJob[CompilationUnit](ops(ops.base, new Eval))
5555
.addJob[CompilationUnit](exp(exp.base, new Exp))
5656
.addJob[CompilationUnit](ops(ops.algebra, new Eval))
57-
.addJob[CompilationUnit](ops(ops.algebra, new PrettyP))
57+
// .addJob[CompilationUnit](ops(ops.algebra, new PrettyP))
5858

5959
// type interfaces (note: Exp is assumed above)
6060

61-
// add here as you are ready...
62-
// Initial object algebra interface for expressions: integers and addition
61+
// add here as you are ready...
62+
// Initial object algebra interface for expressions: integers and addition
6363

6464

6565

66-
lazy val results = EmptyResults().addAll(jobs.run())
66+
lazy val results = EmptyResults().addAll(jobs.run())
6767

6868
}

src/main/scala/example/expression/algebra/ExpressionSynthesis.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ class ExpressionSynthesis(override val domain:DomainModel) extends ExpressionDom
2929
val semanticType:Type = ops(ops.base, new Eval)
3030
}
3131
@combinator object BaseExpClass {
32+
// have a domain object
33+
34+
3235
def apply() : CompilationUnit =
33-
Java(s"""
34-
interface ExpAlg<E> {
36+
Java(s"""package algebra;
37+
|
38+
|interface ExpAlg<E> {
3539
| E lit(int x);
3640
| E add(E e1, E e2);
3741
|}

0 commit comments

Comments
 (0)