doSomething()
    s:Student.
    ?[s.] //s refers to s above
    ?[c:Course] // submatches ?[ ] scope the lhs
    c. // cannot see the above c since ?[ ] scope variables
  ->
    c. // can see the c nested in ?[ ] since all rhs can see lhs, even if lhs is nested in submatches
  ?[ // sub rules scope the lhs and the rhs
     s.
  ->
     c.

Currently the only way I know how to do it is to het variables in the lhs define LHSVariables and let SubRule and SubMatch scope these LHS variables.
Since that will not allow the rhs to refer to lhs vars in submatches the lhs also defines RHSVariables and let only SubRules scope these RHS variables.

(Note that ‘first’ occurrence are defs and subsequent occurrences are refs by desugaring.)

However duplicate definitions in different name spaces seems a bit ugly, can I ‘import’ all nested lhs variables into the rhs?

Submitted by Daco Harkes on 9 December 2014 at 10:48

On 9 December 2014 at 11:05 Guido Wachsmuth commented:

Please be aware that we are not very familiar with your (concrete and abstract) syntax.

Independent of the syntax issue, I see what you try to model here, but I am not sure what the actual issue is. Is it to have only a single namespace Variable and import all definitions from the LHS (and its subscopes, I guess), into the RHS?


On 9 December 2014 at 11:14 Daco Harkes commented:

Yes, the actual issue is to just have a single namespace Variable and import definitions from the LHS and its subscopes into the RHS.


On 9 December 2014 at 11:27 Guido Wachsmuth commented:

We used to have something for all subsequent subscopes, not sure if this was dropped at some point or if this also works for other subscopes. @Gabriël might know.

Log in to post comments