-
Hi guys, I'm building a DSL and making good progress with Langium. Thank you for the great work! My DSL has a complex expression system that needs to be type-checked (resolving expression types). Just wondering what's the proper way to do that:
Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @ymc9,
Yeah, we do the same. It kind of depends on what your type system looks like, but I assume it contains something like interfaces/classes/structured types. In that case the linking step already requires a working type system, as you need it to resolve to fields/methods of classes for example.
We usually just store a map for Note that you need to see whether that also works correctly in case the document is part of an affected document rebuild cycle (i.e. a linked document has changed and the document in question needs to be rebuilt as well). We don't reparse the document in that case, and just throw away all references in that document. Depending on how you set this up, some of your types may become stale due to this.
Unfortunately, not yet. We have some stuff internally, but it's under NDAs. We're currently thinking about building a type-checking framework, which would alleviate most of the heavy-lifting one needs to do regarding type checking, but there's nothing concrete in this direction yet. Probably something that we would tackle in Q1 of 2023. |
Beta Was this translation helpful? Give feedback.
Hey @ymc9,
Yeah, we do the same. It kind of depends on what your type system looks like, but I assume it contains something like interfaces/classes/structured types. In that case the linking step already requires a working type system, as you need it to resolve to fields/methods of classes for example.
We usually just store a map for
AstNode
->type
rela…