Replies: 3 comments 2 replies
-
Hi @goto40, the idea looks nice. It's a pity that we can specify the type of reference target in the grammar, but not how to resolve it. On the other hand, I currently doubt that such an expression syntax would be sufficient for anything more than simple example languages. Scoping implementations for complex expressions tend to be quite involving and often depend on a type system (type inference). |
Beta Was this translation helpful? Give feedback.
-
I like the idea of having no or low-code for things like scoping or the type system. |
Beta Was this translation helpful? Give feedback.
-
Idea for experimenting: create an external DSL (separate from the grammar language) to describe scoping / linking rules (possibly even supporting advanced stuff like function / method overloading). This DSL could be used to generate TypeScript code or be interpreted at runtime. All you'd need to do to use it in your language project is register the generated / interpreter ScopeProvider (and maybe other services) in your DI module. The benefit: this would not complicate the grammar language at all, and would leave lots of room for experimentation. |
Beta Was this translation helpful? Give feedback.
-
What do you think of a grammar extension, we introduced in textx two years ago: http://textx.github.io/textX/3.0/rrel/
The feature makes it easier to define custom scoping within the grammar file (without additional coding). The following discussion illustrates the use of the feature: textX/textX#387
I could imagine that this could be relatively straightforward to incorporate into langium (langium grammar extension and extended default scope provider).
I would be happy to discuss this. With a little guidance I could prepare something if we agree on a feature.
Beta Was this translation helpful? Give feedback.
All reactions