Skip to content
Snippets Groups Projects
Commit 7394fad6 authored by Philippe Suter's avatar Philippe Suter
Browse files

Progress from car ride.

parent 782c3dea
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,10 @@ object CodeGenPhase extends LeonPhase[Program,CompilationResult] { ...@@ -19,6 +19,10 @@ object CodeGenPhase extends LeonPhase[Program,CompilationResult] {
val cName = programToClassName(p) val cName = programToClassName(p)
for((p,cs) <- p.algebraicDataTypes) {
// val acf = new ClassFile(p....
}
val cf = new ClassFile(cName, None) val cf = new ClassFile(cName, None)
cf.addDefaultConstructor cf.addDefaultConstructor
......
...@@ -43,6 +43,7 @@ object Definitions { ...@@ -43,6 +43,7 @@ object Definitions {
def definedFunctions = mainObject.definedFunctions def definedFunctions = mainObject.definedFunctions
def definedClasses = mainObject.definedClasses def definedClasses = mainObject.definedClasses
def classHierarchyRoots = mainObject.classHierarchyRoots def classHierarchyRoots = mainObject.classHierarchyRoots
def algebraicDataTypes = mainObject.algebraicDataTypes
def callGraph = mainObject.callGraph def callGraph = mainObject.callGraph
def calls(f1: FunDef, f2: FunDef) = mainObject.calls(f1, f2) def calls(f1: FunDef, f2: FunDef) = mainObject.calls(f1, f2)
def callers(f1: FunDef) = mainObject.callers(f1) def callers(f1: FunDef) = mainObject.callers(f1)
...@@ -84,6 +85,10 @@ object Definitions { ...@@ -84,6 +85,10 @@ object Definitions {
lazy val classHierarchyRoots : Seq[ClassTypeDef] = defs.filter(_.isInstanceOf[ClassTypeDef]).map(_.asInstanceOf[ClassTypeDef]).filter(!_.hasParent) lazy val classHierarchyRoots : Seq[ClassTypeDef] = defs.filter(_.isInstanceOf[ClassTypeDef]).map(_.asInstanceOf[ClassTypeDef]).filter(!_.hasParent)
lazy val algebraicDataTypes : Map[AbstractClassDef,Seq[CaseClassDef]] = (defs.collect {
case c @ CaseClassDef(_, Some(_), _) => c
}).groupBy(_.parent.get)
lazy val (callGraph, callers, callees) = { lazy val (callGraph, callers, callees) = {
type CallGraph = Set[(FunDef,FunDef)] type CallGraph = Set[(FunDef,FunDef)]
......
object Prog002 {
sealed abstract class List
case class Nil() extends List
case class Cons(head : Int, tail : List) extends List
def isNil(l : List) : Boolean = {
l == Nil()
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment