I have two DSL. The first is the input DSL:
Model:
attributes += Attribute*
;
Attribute:
name=ID
;
And here is the mapping DSL:
Model:
mappings += Mapping*
;
Mapping:
target=[input::Attribute] '=' source=[input::Attribute]
;
Now, I want to extend the mapping with sources which are defined in the mapping DSL, e.g.:
Property:
'property' name=ID '=' value=STRING
;
And then write such DSL files:
property prop = "somevalue"
A = prop
B = SourceAttribute
The question is, how to extend the Mapping grammar. Property and Attribute are in different DSLs. Preferrably, I would not want to modify the input DSL. The following is obviously ambiguous and does not work:
Mapping:
target=[input::Attribute] '=' source=[Source]
;
Source:
attribute=[input::Attribute]
|
property=[Property]
;
I know of a few ways I could solve this but would like to hear from experts how they would solve this situation.