Skip to content
Snippets Groups Projects
Commit 542dea5c authored by Manos Koukoutos's avatar Manos Koukoutos
Browse files

Update bonsai to latest version

parent ca2a7b6b
No related branches found
No related tags found
No related merge requests found
......@@ -144,8 +144,7 @@ fork in IsabelleTest := true
def ghProject(repo: String, version: String) = RootProject(uri(s"${repo}#${version}"))
lazy val bonsai = ghProject("git://github.com/colder/bonsai.git", "0fec9f97f4220fa94b1f3f305f2e8b76a3cd1539")
lazy val bonsai = ghProject("git://github.com/colder/bonsai.git", "10eaaee4ea0ff6567f4f866922cb871bae2da0ac")
lazy val scalaSmtLib = ghProject("git://github.com/regb/scala-smtlib.git", "372bb14d0c84953acc17f9a7e1592087adb0a3e1")
lazy val root = (project in file(".")).
......
......@@ -20,7 +20,7 @@ class GrammarDataGen(evaluator: Evaluator, grammar: ExpressionGrammar[TypeTree]
implicit val ctx = evaluator.context
def generate(tpe: TypeTree): Iterator[Expr] = {
val enum = new MemoizedEnumerator[TypeTree, Expr](grammar.getProductions)
val enum = new MemoizedEnumerator[TypeTree, Expr, Generator[TypeTree, Expr]](grammar.getProductions)
enum.iterator(tpe)
}
......
......@@ -3,8 +3,6 @@
package leon
package grammars
import bonsai._
import purescala.Expressions._
import purescala.Types._
import purescala.Common._
......
/* Copyright 2009-2015 EPFL, Lausanne */
package leon
package grammars
import bonsai.{Generator => Gen}
object GrammarTag extends Enumeration {
val Top = Value
}
import GrammarTag._
class Generator[T, R](subTrees: Seq[T], builder: Seq[R] => R, tag: Value) extends Gen[T,R](subTrees, builder)
object Generator {
def apply[T, R](subTrees: Seq[T], builder: Seq[R] => R, tag: Value = Top) = new Generator(subTrees, builder, tag)
}
\ No newline at end of file
......@@ -242,7 +242,7 @@ class Repairman(ctx0: LeonContext, initProgram: Program, fd: FunDef, verifTimeou
val maxValid = 400
val evaluator = new CodeGenEvaluator(ctx, program, CodeGenParams.default)
val enum = new MemoizedEnumerator[TypeTree, Expr](ValueGrammar.getProductions)
val enum = new MemoizedEnumerator[TypeTree, Expr, Generator[TypeTree, Expr]](ValueGrammar.getProductions)
val inputs = enum.iterator(tupleTypeWrap(fd.params map { _.getType})).map(unwrapTuple(_, fd.params.size))
......
......@@ -182,7 +182,7 @@ class ExamplesFinder(ctx0: LeonContext, program: Program) {
}) getOrElse {
// If the input contains free variables, it does not provide concrete examples.
// We will instantiate them according to a simple grammar to get them.
val enum = new MemoizedEnumerator[TypeTree, Expr](ValueGrammar.getProductions)
val enum = new MemoizedEnumerator[TypeTree, Expr, Generator[TypeTree, Expr]](ValueGrammar.getProductions)
val values = enum.iterator(tupleTypeWrap(freeVars.map { _.getType }))
val instantiations = values.map {
v => freeVars.zip(unwrapTuple(v, freeVars.size)).toMap
......
package leon
package synthesis.disambiguation
import synthesis.RuleClosed
import synthesis.Solution
import evaluators.DefaultEvaluator
import purescala.Expressions._
......@@ -14,10 +13,9 @@ import purescala.Definitions.Program
import purescala.DefOps
import grammars.ValueGrammar
import bonsai.enumerators.MemoizedEnumerator
import solvers.Model
import solvers.ModelBuilder
import scala.collection.mutable.ListBuffer
import leon.grammars.ExpressionGrammar
import grammars._
object QuestionBuilder {
/** Sort methods for questions. You can build your own */
......@@ -142,7 +140,7 @@ class QuestionBuilder[T <: Expr](
def result(): List[Question[T]] = {
if(solutions.isEmpty) return Nil
val enum = new MemoizedEnumerator[TypeTree, Expr](value_enumerator.getProductions)
val enum = new MemoizedEnumerator[TypeTree, Expr, Generator[TypeTree,Expr]](value_enumerator.getProductions)
val values = enum.iterator(tupleTypeWrap(_argTypes))
val instantiations = values.map {
v => input.zip(unwrapTuple(v, input.size))
......
......@@ -8,15 +8,13 @@ import purescala.Expressions._
import purescala.Common._
import purescala.Types._
import purescala.Constructors._
import purescala.Quantification._
import evaluators._
import codegen.CodeGenParams
import utils._
import grammars._
import bonsai._
import bonsai.enumerators._
import bonsai.{Generator => Gen}
case object BottomUpTEGIS extends BottomUpTEGISLike[TypeTree]("BU TEGIS") {
def getGrammar(sctx: SynthesisContext, p: Problem) = {
......@@ -110,7 +108,7 @@ abstract class BottomUpTEGISLike[T <: Typed](name: String) extends Rule(name) {
val targetType = tupleTypeWrap(p.xs.map(_.getType))
val wrappedTests = tests.map { case (is, os) => (is, tupleWrap(os))}
val enum = new BottomUpEnumerator[T, Expr, Expr](
val enum = new BottomUpEnumerator[T, Expr, Expr, Generator[T, Expr]](
grammar.getProductions,
wrappedTests,
{ (vecs, gen) =>
......
......@@ -71,7 +71,7 @@ abstract class TEGISLike[T <: Typed](name: String) extends Rule(name) {
val evalParams = CodeGenParams.default.copy(maxFunctionInvocations = 2000)
val evaluator = new DualEvaluator(sctx.context, sctx.program, evalParams)
val enum = new MemoizedEnumerator[T, Expr](grammar.getProductions)
val enum = new MemoizedEnumerator[T, Expr, Generator[T, Expr]](grammar.getProductions)
val targetType = tupleTypeWrap(p.xs.map(_.getType))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment