-
hallo, I have a question about cross-references.
when the input is
greetings happens before the defination of pereson and working fine but in the programming we have something like var = 10 newvar = var + 20 // should work newvar = var + 20 // I want to show a problem here because var is not yet defined is this possible with languim to track the position? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You can extract the location from the concrete syntax tree |
Beta Was this translation helpful? Give feedback.
-
Hallo langium Team, Could you please give a small example of this? |
Beta Was this translation helpful? Give feedback.
You can do something like this (using the
HelloWorld
grammar as an example):Depending on the complexity of your language, you might need to to more AST analysis to determine whether the variable has been declared yet. However, this simple comparison should help you along quite well.