Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c41c6b5
preparing to update CoGen to use FFIs from DP.
heineman Mar 18, 2026
db8df3d
First intake for revised FFIs
heineman Mar 18, 2026
a8eb37c
Progress...
heineman Mar 18, 2026
dfb8623
Integrated DynamicProgramming subproject and upgraded to work with la…
heineman Mar 19, 2026
6dd46df
minor
heineman Mar 19, 2026
f84511c
fixed issue of "bottomup" in match statement based on command line. A…
heineman Mar 19, 2026
2e42f25
Cleanup: remove old features, remove ternary, fix some scala 3 syntax…
JanBessai Mar 22, 2026
a54a9ac
Addressed Array create properly across all DP variations.
heineman Mar 25, 2026
8329eda
In the middle of creating Array support for inBetween/Scala
heineman Apr 1, 2026
c9dfe66
Some initial progress on arrays.
JanBessai Apr 1, 2026
7604540
Better array initialization in inbetween and newScala
JanBessai May 13, 2026
56a772a
Added some boilerplate array code to hello world, to test arrays.
heineman May 20, 2026
099fd63
Simplified way in which *java and *scala main classes are defined, to…
heineman May 20, 2026
493dcf0
updated internal generic tests at inbetween to properly generate test…
heineman May 22, 2026
44a138f
Completed updates to internal inbetween/Scala arrayLogic. Now generat…
heineman May 23, 2026
64e41d4
Cleaned up and documented all early prototypes and unenhanced models.
heineman May 26, 2026
cac16b8
Converted MOST of the Expression subclasses into case classes, which …
heineman May 27, 2026
ad30539
Converted MOST of the Expression subclasses into case classes, which …
heineman May 27, 2026
3644e8c
Refactored boilerplate. Made some progress on Exceptions in in-betwee…
heineman May 31, 2026
1f9399d
Finally refactored way that EnhancedDPObjectOrientedProvider deals wi…
heineman Jun 1, 2026
e1d89f0
Fixed scala test generation, which inadvertently had generated code t…
heineman Jun 1, 2026
7194b71
Fixed scala code generation for test cases.
heineman Jun 1, 2026
d68a49c
Annotated all packages to properly reflect Dependence/Independence of…
heineman Jun 2, 2026
9d19384
Cleaned up code and documentation in advance of publishing new cogen …
heineman Jun 3, 2026
80896c9
Good stopping point.
heineman Jun 3, 2026
576e569
Fix maps
JanBessai Jun 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package org.combinators.ep.approach.oo

/*DI:LI:AD*/
package org.combinators.ep.approach.oo /*DI:LI:AD*/
import org.combinators.cogen.{TestCase, TypeRep, Command, NameProvider, AbstractSyntax, Understands}
import Command.Generator
import org.combinators.cogen.paradigm.{AddImport, AnyParadigm, FindClass, Generics, ObjectOriented, ParametricPolymorphism, ResolveImport}
Expand Down Expand Up @@ -99,7 +97,7 @@ trait ExtensibleVisitor extends SharedOO with OperationAsClass {
_ <- addTypeParameter(visitTyParam, Command.skip)

// this returns mangled visitTypeParameter name and gets list of all type parameters, for which there is only one, so we get head
args <- getTypeArguments()
args <- getTypeArguments
_ <- setReturnType(args.head)

// identify Visitor<R>
Expand Down Expand Up @@ -178,7 +176,7 @@ trait ExtensibleVisitor extends SharedOO with OperationAsClass {
}

/**
* Creates the signature for the 'abstract R visit(DataType exp)' method which still has no body, and can
* Creates the signature for the 'abstract R visit(DataType exp)' method which still has no code body, and can
* thus become an abstract interface declaration or form the basis for an implementation.
*
* {{{
Expand Down Expand Up @@ -390,7 +388,7 @@ trait ExtensibleVisitor extends SharedOO with OperationAsClass {
* Compute the name for the visitor interface of the given model, if a new interface is required.
*
* Base remains as {visitorClass}
* sub-classes are {visitorClass}DataTypes...
* subclasses are {visitorClass}DataTypes...
*/
def visitorInterfaceName(model: GenericModel): Seq[Name] = {
if (model.isDomainBase) {
Expand Down Expand Up @@ -428,7 +426,7 @@ trait ExtensibleVisitor extends SharedOO with OperationAsClass {
vType = visitorInterfaceName(model) // convert Name to a class

visitorClassType <- findClass(vType *)
tpeParam <- getTypeArguments()
tpeParam <- getTypeArguments
instVisitClassType <- applyType(visitorClassType, tpeParam)
castV <- castObject(instVisitClassType, v)
// invoke visit method on 'v' with 'this' as argument
Expand Down Expand Up @@ -517,7 +515,7 @@ trait ExtensibleVisitor extends SharedOO with OperationAsClass {
} yield ()
}

/** Take existing visitor generated by Shared and add (where needed) a "extends VisitorSub<R>"
/** Take existing visitor generated by Shared and add (where needed) "extends VisitorSub<R>"
*
* @param domain create visitor interface for the given model in the extension graph.
* @return
Expand Down Expand Up @@ -767,15 +765,15 @@ trait ExtensibleVisitor extends SharedOO with OperationAsClass {
val modelToUse = modelsToUse.head

/**
* There is special case in k1 for MultBy, which needs a makeEval factory method but it isn't overridden
* There is special case in k1 for MultBy, which needs a makeEval factory method, but it isn't overridden
* because it is a dependent operation and appears for the first time.
*
* makeIsNeg in the Eql.java file in j3 DOES NOT override because it is first presence. Fix this by
* identifying that while the operation came from the PAST the dependent operations are, in fact, defined
* in modelToUse so they cannot be overridden. DONE
*
* Harder one is k1.MultBy which has a dependent operation Eval, but ONLY for the first time in K1 and
* no one before. IN Java if this is public without @Override annotation it works OK. However in Scala
* no one before. IN Java if this is public without @Override annotation it works OK. However, in Scala
* there truly needs to be the "override" keyword.
*
* Final one is a result of single inheritance. Once k2j6 decides to extend from j3 branch, methods that
Expand Down Expand Up @@ -821,10 +819,10 @@ trait ExtensibleVisitor extends SharedOO with OperationAsClass {
// ever happens, logic like above could be used, though .filter (p => p.beforeOrEqual(primaryParent.get)).head
n = n.former.head
}
exists_in_past // if exists in past, then must override
exists_in_past // if exists in the past, then must override
}
} else {
// for O1 need to double check modelToUse != domain since means parent exists
// for O1 need to double-check modelToUse != domain since means parent exists
(!modelToUse.ops.contains(operation)) || (modelToUse != domain) // if same COULD be defining, but only if previously defined
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package org.combinators.ep.approach.oo

/*DI:LI:AD*/
package org.combinators.ep.approach.oo /*DI:LI:AD*/

import org.combinators.cogen.{Command, TestCase, TypeRep, Understands, NameProvider, AbstractSyntax}
import Command.Generator
Expand Down Expand Up @@ -186,7 +184,7 @@ sealed trait Interpreter extends SharedOO {
for {
_ <- setInterface()

// former merge points need to be included, so past.lastModelWithOperation) is changed to below. Make
// former merge points need to be included, so past.lastModelWithOperation is changed to below. Make
// sure to 'distinct' these models to avoid adding same interface multiple time (can happen with 3-way merge)
_ <- forEach(domain.former.map(past => latestModelDefiningNewTypeInterface(past)).distinct) { m =>
for {
Expand Down Expand Up @@ -286,9 +284,6 @@ sealed trait Interpreter extends SharedOO {

/**
* Access attributes using default getter methods.
*
* @param attribute Data Type Case attribute to be accessed
* @return
*/
def attributeInterpreterAccess(att: Attribute, tpeCase: DataTypeCase, domain: GenericModel, baseType: Option[paradigm.syntax.Type]): Generator[MethodBodyContext, Expression] = {
import ooParadigm.methodBodyCapabilities._
Expand Down Expand Up @@ -361,7 +356,7 @@ sealed trait Interpreter extends SharedOO {
}
}

// add a parent IF type defined earlier, in ANY of its formers..
// add a parent IF type defined earlier, in ANY of its formers.
def shouldAddParent: Boolean = {
model.former.exists(m => m.findTypeCase(tpeCase).isDefined)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package org.combinators.ep.approach.oo

/*DI:LI:AD*/
package org.combinators.ep.approach.oo /*DI:LI:AD*/

import org.combinators.cogen.{TestCase, TypeRep, Command, Understands, NameProvider, AbstractSyntax}
import Command.Generator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.combinators.ep.approach.oo /*DI:LI:AD*/
package org.combinators.ep.approach.oo /*DI:LI:AD*/

import org.combinators.cogen.Command.Generator
import org.combinators.cogen.paradigm.AnyParadigm.syntax._
Expand All @@ -18,7 +18,7 @@ import org.combinators.ep.domain.extensions._
* Runtime Dispatch
*
* Have to decide whether to use side effects or Generics. This current implementation uses the Visitor<R> generics
* approach, which can be adopted by different object oriented languages.
* approach, which can be adopted by different object-oriented languages.
*/
trait RuntimeDispatch extends SharedOO with OperationAsClass {
val paradigm: AnyParadigm
Expand Down Expand Up @@ -125,7 +125,7 @@ trait RuntimeDispatch extends SharedOO with OperationAsClass {
*/
def makeDispatchingOperation(model: GenericModel, op: Operation): Generator[ClassContext, Unit] = {
def ifStmt(): Generator[MethodBodyContext, Option[Expression]] = {
import exceptions.exceptionCapabilities._
import exceptions.exceptionsCapabilities._
import impParadigm.imperativeCapabilities._
import ooParadigm.methodBodyCapabilities._
import paradigm.methodBodyCapabilities._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ trait SharedOO extends ApproachImplementationProvider {
}

/**
* Make a single getter method for the 'att' attribute which only has signature, and no body.
* Make a single getter method for the 'att' attribute which only has signature, and no code body.
*
* The following example is for the 'Right' attribute where the type is mapped to Exp
* {{{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package org.combinators.ep.approach.oo

/*DI:LI:AD*/
package org.combinators.ep.approach.oo /*DI:LI:AD*/

import org.combinators.cogen.{Command, NameProvider, AbstractSyntax}
import Command.Generator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package org.combinators.ep.approach.oo

/*DI:LI:AD*/
package org.combinators.ep.approach.oo /*DI:LI:AD*/

import org.combinators.cogen.{TestCase, TypeRep, Command, NameProvider, AbstractSyntax, Understands}
import org.combinators.cogen.paradigm.{AddImport, AnyParadigm, FindClass, ObjectOriented, ResolveImport}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ trait Visitor extends SharedOO with OperationAsClass { self =>
_ <- addTypeParameter(visitTyParam, Command.skip)

// this returns mangled visitTypeParameter name and gets list of all type parameters, for which there is only one, so we get head
args <- getTypeArguments()
args <- getTypeArguments
_ <- setReturnType(args.head)

// identify Visitor<R>
Expand Down Expand Up @@ -641,7 +641,7 @@ trait Visitor extends SharedOO with OperationAsClass { self =>
}

/**
* Creates the signature for the 'abstract R visit(DataType exp)' method which still has no body, and can
* Creates the signature for the 'abstract R visit(DataType exp)' method which still has no code body, and can
* thus become an abstract interface declaration or form the basis for an implementation.
*
* {{{
Expand Down Expand Up @@ -755,7 +755,7 @@ trait Visitor extends SharedOO with OperationAsClass { self =>
_ <- addClassToProject(visitorSpecifics.makeVisitorInterface(flatDomain.typeCases.distinct), visitorClass)

// Figure out which model to use for this operation so it aligns with EIPS. In fact, sending flatDomain is exactly wrong
// if two predecessors (and cannot decide which one to take) then we are in charge otherwise we pick one branch that has latest one
// if two predecessors (and cannot decide which one to take) then we are in charge otherwise we pick one branch that has the latest one
_ <- forEach (flatDomain.ops) { op => {
addClassToProject(visitorSpecifics.makeOperationImplementation(gdomain, op, domainSpecific), names.mangle(names.conceptNameOf(op)))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package org.combinators.ep.approach.oo

/*DI:LI:AD*/
package org.combinators.ep.approach.oo /*DI:LI:AD*/

import org.combinators.cogen.paradigm.{AnyParadigm, ObjectOriented}
import org.combinators.ep.domain.{GenericModel, GraphViz}
Expand All @@ -20,7 +18,7 @@ import org.combinators.ep.domain.extensions._
* https://dreampuf.github.io/GraphvizOnline
*
* Choose "graphviz" as the approach and (for either Java or Scala) generate the resulting
* code. What it does, instead, is generate the OO solution and then creates files, either
* code. What it does, instead, is to generate the OO solution and then creates files, either
* "eip.viz" (structural evolution) or "evolution.viz" (which also includes dependency links)
* that you can copy and paste into the above service.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ final class CPPClass (val _name:String, _signature:String, val _publicArea:Seq[C
val name:String = _name
val signature:String = _signature
val publicArea:Seq[CPPElement] = _publicArea
val privateArea:Seq[CPPElement] = _privateArea
val privateArea:Seq[CPPElement] = _privateArea
var superClass : String = ""

override def fileName:String = name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ trait WadlerGenerator extends GJGenerator {

// base will be assumed to have at least one datatype exp and one e
val baseMethods = model.types.map(exp => {
val params:String = exp.attributes.map(att => GJ(s"${typeConverter(att.tpe)} ${att.instance}")).mkString(",")
val params:String = exp.attributes.map(att => GJ(s"${typeConverter(att.tpe)} ${att.instance}")).mkString(",")
GJ(s"public R for${exp.concept}($params);")
})

Expand Down Expand Up @@ -116,7 +116,7 @@ trait WadlerGenerator extends GJGenerator {
def generateBase(base:Model): Seq[GJWithPath] = {
// base will be assumed to have at least one datatype exp and one e
val baseMethods = base.types.map(exp => {
val params:String = exp.attributes.map(att => GJ(s"${typeConverter(att.tpe)} ${att.instance}")).mkString(",")
val params:String = exp.attributes.map(att => GJ(s"${typeConverter(att.tpe)} ${att.instance}")).mkString(",")
GJ(s"public R for${exp.concept}($params);")
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ trait HaskellGenerator extends DomainIndependentGenerator with StandardHaskellBi
Haskell(s"${exp.concept} $list") // not sure how much this is needed
}).mkString(" | ")

val binaryTreeInterface = if (m.flatten().hasBinaryMethod) {
val binaryTreeInterface = if (m.flatten().hasBinaryMethod) {
// astree method declaration
definedDataSubTypes("", m.types) ++ declarations
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ trait ALaCarteTestGenerator extends HUnitTestGenerator {
Haskell(s"${exp.concept}T $list") // not sure how much this is needed
}).mkString(" | ")

val binaryTreeInterface = if (m.flatten().hasBinaryMethod) {
val binaryTreeInterface = if (m.flatten().hasBinaryMethod) {
// astree method declaration
definedDataSubTypes("", m.types) ++ declarations
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ trait e6 extends Evolution with HaskellGenerator with HUnitTestGenerator with M0
case Equals =>
exp match {
case Lit =>
val value2 = Haskell(expression(exp, litValue).getCode + "2")
val value2 = Haskell(expression(exp, litValue).getCode + "2")
result(Haskell(s" ${expression(exp, litValue)} == $value2 "))

case u:Unary =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ trait GrowGenerator extends HaskellGenerator with StandardHaskellBinaryMethod wi
* @return
*/
override def generateDataTypes(m:domain.Model): HaskellWithPath = {
val binaryTreeInterface = if (m.flatten().hasBinaryMethod) {
val binaryTreeInterface = if (m.flatten().hasBinaryMethod) {
definedDataSubTypes("", m.types) ++ declarations
} else {
Seq.empty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.combinators.ep.language.scala /*DI:LD:AI*/

import cats.{Apply => _}
import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.generator.Command
//import org.combinators.ep.generator.paradigm.{Generics, ParametricPolymorphism}
import org.combinators.ep.language.scala.paradigm._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.domain.instances.InstanceRep
import org.combinators.ep.generator.Command
import org.combinators.ep.generator.Command.Generator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Main {
generator.doublesInMethod,
generator.booleansInMethod,
generator.equalityInMethod)
val m8_eip = eips.M8.imperative[approach.paradigm.type,ApproachImplementationProvider.WithParadigm](approach.paradigm)(m7i2_eip)(
val m8_eip = eips.M8.imperative[approach.paradigm.type,ApproachImplementationProvider.WithParadigm](approach.paradigm)(m7i2_eip)(
generator.imperativeInMethod,
generator.doublesInMethod,
generator.booleansInMethod,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.combinators.ep.language.scala.paradigm /*DI:LD:AI*/
import java.nio.file.{Path, Paths}

import scala.meta._
import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.domain.instances.InstanceRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.{Command, FileWithPath, Understands}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.generator.paradigm.{AddImport, AddMethod, AddType, AddTypeConstructor, AddTypeLookup, FindMethod, FindType, InstantiateType, ResolveImport, ToTargetLanguageType, Functional => Func}
import org.combinators.ep.language.scala.{Syntax, TypeCtxt, _}
import org.combinators.ep.generator.Understands
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.domain.instances.InstanceRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.{Command, Understands}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm.ffi /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.Understands
import org.combinators.ep.generator.paradigm.Apply
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm.ffi /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.{Command, Understands}
import org.combinators.ep.generator.paradigm.{Apply, Functional}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm.ffi /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.Understands
import org.combinators.ep.generator.paradigm.Apply
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm.ffi /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.{Command, Understands}
import org.combinators.ep.generator.paradigm.{Apply, GetMember}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm.ffi /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.domain.instances.InstanceRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.{Command, Understands}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm.ffi /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.paradigm.Apply
import org.combinators.ep.generator.paradigm.ffi.{Abs, Cos, EulersNumber, Floor, Log, Pi, Pow, Sin, Sqrt, RealArithmetic => RArith}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm.ffi /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.generator.Command.Generator
import org.combinators.ep.generator.{Command, Understands}
import org.combinators.ep.generator.paradigm.{Apply, GetMember}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.combinators.ep.language.scala.paradigm.ffi /*DI:LD:AI*/

import org.combinators.ep.domain.abstractions.TypeRep
import org.combinators.cogen.TypeRep
import org.combinators.ep.domain.instances.InstanceRep
import org.combinators.ep.domain.tree.{Leaf, Node}
import org.combinators.ep.generator.Command.Generator
Expand Down
Loading
Loading