I'm trying to come up with a good design for an AS...
# functional
t
I'm trying to come up with a good design for an AST, but the problem is that I need to construct it in two different ways from two different source data structures. I'm unsure how to make it readable and maintainable without a ton of boilerplate. Does anyone have any tips on this?
r
Not sure if you have already looked into Kastree but they model Kotlin in an AST with an ADT of sealed classes.
t
I know how to declare an ADT of course. The hard part is how to construct values of the AST or rather how to declare the AST in such a way that it will be easy to construct incrementally (reusing common code) and lazily from 2 different source data structures with non-local knowledge. Kastree is homomorphic to Psi and completely strict, that makes the whole thing much easier.