At Strumenta among other things, we build parsers. We typically start with ANTLR, get a parse-tree and then translate it to an AST, implemented using some library we created, like Kolasu, in the case the project is written in Kotlin.
The AST is a model for us, and we need features like the ability to specify properties, containment relations, and references.
For example, we could define a series of Kotlin dataclasses, like this one:
data class EqualityExpr( override val left: Expression, override val right: Expression, override val specifiedPosition: Position? = null ) : BinaryComparisonExpr(left, right, specifiedPosition)
This would be our lightweight way to define the metamodel.
We would then have instances of such classes, organized in a tree, and that would be our model. We typically process it in memory, but given we sometimes need to write the parser in one language and then the successive stages in another we could serialize it in JSON or XML. For example, we could need to write the parser in Kotlin, get the model serialized, and then load it from Python to do some code generation.
We typically need to traverse, transform, and generate stuff out of these models.
We also need tools to process the metamodel (in our cases defined by a series of class definitions) to generate things like the documentation.
Over time we have started building this functionalities but…
At some point, we realized we are basically building some much very basic clone of EMF.
Now we wonder… is that some alternative we should just adopt?
I remembered having used RGen many years ago as a lightweight replacement of EMF.
Maybe we could just use the XMI format.
It seems surprising that there is not a solution to this specific problem.
So before investing the next 5 years building it, I wanted to check with you if you know of alternatives to use or if instead this would be actually useful.