-
Hi, the default scoping seems to be tree-based (sibblings and anchestors). Before starting, I wanted to ask if there is already a reference for this, as it seems not so uncommon to want the following behavior: Only check for past references. To illustrate, let me give a simplified example:
Simplified example for the targeted grammar:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
how are the definition and eval block related? in your grammar they are siblings. you also dont assign them to lists. |
Beta Was this translation helpful? Give feedback.
-
FYI, there are a few issues with your grammar:
having everything unassigned will lead to a lot of issues in general. Unassigned rule calls should only be used in special circumstances. Regarding your questions:
I wouldn't recommend adding that to the scoping mechanism. Instead, I would handle this similar to most other programming languages: Allow scoping to "future" elements, but add a validation that ensures that the user gets an error:
Can you clarify? What do you mean by "a block defines global scope"? |
Beta Was this translation helpful? Give feedback.
-
I got some good hints, thanks for your input. |
Beta Was this translation helpful? Give feedback.
You can create an override of the
ScopeComputation
service similar to here. But instead of building fully qualified names, you just expose all elements to the global scope with their given names.