Skip to content
Snippets Groups Projects
Commit e5046873 authored by Ali Sinan Köksal's avatar Ali Sinan Köksal
Browse files

reorganize call transformation a little.

parent 0e8102a6
No related branches found
No related tags found
No related merge requests found
...@@ -32,19 +32,20 @@ trait CallTransformation ...@@ -32,19 +32,20 @@ trait CallTransformation
println("Here is the extracted FunDef:") println("Here is the extracted FunDef:")
println(fd) println(fd)
/* val codeGen = new CodeGenerator(unit, currentOwner)
typer.typed(atOwner(currentOwner) {
code fd.body match {
}) case None => println("Could not extract choose predicate: " + funBody); super.transform(tree)
*/ case Some(b) =>
super.transform(tree) val (readProgram, progSym) = codeGen.generateProgramRead(filename)
val solverInvocation = codeGen.generateSolverInvocation(b, progSym)
/* val code = Block(readProgram :: Nil, solverInvocation)
val solver = new FairZ3Solver(new DefaultReporter)
solver.setProgram(prog) typer.typed(atOwner(currentOwner) {
println(solver.decide(fd.body.get, false)) code
*/ })
}
} }
case _ => super.transform(tree) case _ => super.transform(tree)
......
...@@ -40,7 +40,7 @@ trait CodeGeneration { ...@@ -40,7 +40,7 @@ trait CodeGeneration {
(readStatement, progSymbol) (readStatement, progSymbol)
} }
def generateSolverInvocation(formula: Expr) : Tree = { def generateSolverInvocation(formula: Expr, progSymbol: Symbol) : Tree = {
val solverSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "solver")).setInfo(fairZ3SolverClass.tpe) val solverSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "solver")).setInfo(fairZ3SolverClass.tpe)
val solverDeclaration = val solverDeclaration =
ValDef( ValDef(
...@@ -63,7 +63,7 @@ trait CodeGeneration { ...@@ -63,7 +63,7 @@ trait CodeGeneration {
Ident(solverSymbol), Ident(solverSymbol),
setProgramFunction setProgramFunction
), ),
List(/* read program into a var and plug its symbol here */) List(Ident(progSymbol))
) )
val invocation = val invocation =
...@@ -72,7 +72,7 @@ trait CodeGeneration { ...@@ -72,7 +72,7 @@ trait CodeGeneration {
Ident(solverSymbol), Ident(solverSymbol),
decideWithModelFunction decideWithModelFunction
), ),
List(/* convert pred into scala AST and plug it here */) List(/* convert pred into scala AST of funcheck expression and plug it here */)
) )
Block( Block(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment