Commit 788e670e authored by Arthur Bit-Monnot's avatar Arthur Bit-Monnot

[anml] Split project into (language-independent) model and parser for anml.

parent 80c8dbb6
......@@ -63,15 +63,24 @@ lazy val root = project
publishLocal := {}
)
lazy val planningModel = project
.in(file("planning/model"))
.settings(name := "dahu-planning-model")
.settings(commonSettings: _*)
.settings(libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.3.3",
"org.typelevel" %% "spire" % "0.14.1"
))
lazy val anml = project
.in(file("anml"))
.in(file("planning/anml"))
.settings(name := "dahu-anml")
.dependsOn(planningModel)
.settings(commonSettings: _*)
.settings(libraryDependencies ++= Seq(
"com.lihaoyi" %% "fastparse" % "1.0.0",
"com.github.scopt" %% "scopt" % "3.7.0",
"com.chuusai" %% "shapeless" % "2.3.3",
"org.typelevel" %% "spire" % "0.14.1",
"org.scalatest" %% "scalatest" % "3.0.5" % "test"
))
......
......@@ -422,9 +422,6 @@ object SatisfactionProblem {
override def getInternalID(k: X): ID = lt.get(k).value
}
val satRoot = lt.get(root).valid
val str = RootedLazyTree(satRoot, totalTrees).fullTree.toString
println(str)
println(str.size)
RootedLazyTree(satRoot, totalTrees)
}
......
package dahu.planner
import copla.lang.model.common._
import copla.lang.model.core._
import copla.lang.model.transforms.ActionInstantiation
import dahu.planning.model.common._
import dahu.planning.model.core._
import dahu.planning.model.transforms.ActionInstantiation
import dahu.model.input.{Ident, Input, Tentative}
case class Action[F[_]](name: String,
......
package dahu.planner
import copla.lang.model.common
import copla.lang.model.common.operators.BinaryOperator
import copla.lang.model.common.{Cst => _, _}
import copla.lang.model.core._
import copla.lang.model.core
import dahu.planning.model.common
import dahu.planning.model.common.operators.BinaryOperator
import dahu.planning.model.common.{Cst => _, _}
import dahu.planning.model.core._
import dahu.planning.model.core
import dahu.model.functions.{Fun2, FunN, Reversible}
import dahu.model.input._
import dahu.model.input.dsl._
......
package dahu.planner
import copla.lang
import copla.lang.model.core.{ActionTemplate, Statement}
import dahu.planning.model.core.{ActionTemplate, Statement}
import dahu.utils.errors._
import java.io.{File, FileWriter}
import copla.lang.model.core
import dahu.planning.model.core
import dahu.model.input.Tentative
import monix.eval.{MVar, Task}
......@@ -110,14 +109,14 @@ object Main extends App {
def solve(problemFile: File, deadline: Long)(implicit cfg: Config): Option[String] = {
info("Parsing...")
lang.parse(problemFile) match {
case lang.Success(model) =>
dahu.planning.parse(problemFile) match {
case dahu.planning.Success(model) =>
solveIncremental(model, cfg.maxInstances, deadline)
case lang.ParseError(fail) =>
case dahu.planning.ParseError(fail) =>
println("Parsing failed:")
println(fail.format)
sys.exit(1)
case lang.Crash(msg, err) =>
case dahu.planning.Crash(msg, err) =>
println(s"Parser crashed: $msg")
err.foreach(_.printStackTrace())
sys.exit(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment