[TCS] More than one syntax construction per class AND optional keywords [message #611113] |
Tue, 08 January 2008 10:09 |
Gustavo Cabral Messages: 20 Registered: July 2009 |
Junior Member |
|
|
Hi everyone,
Is it possible to define more than one syntax definition per class
of the DSL metamodel. For example, something like this:
-- KM3
class NounNamePlural {
attribute name : String;
attribute plural : String;
}
-- TCS (Solution 2)
template NounNamePlural addToContext
: name "is a noun and its plural form is" plural "."
;
template NounNamePlural addToContext
: name "is a noun; its plural form is" plural "."
;
-- TCS (Solution 2)
template NounNamePlural addToContext
: name "is a noun and its plural form is" plural "."
| name "is a noun; its plural form is" plural "."
;
I know the code\syntax above doesn't work! Is there any alternative syntax
I can use? In ANTLR, I would use the | constructor. What would it be in
TCS?
The second question is: is it possible to have optional constructor? In
ANTLT it would be ( "optional terminal or nonterminal" )?. In TCS? I would
like to have:
template NounNamePlural addToContext
: name "is a noun and its plural" ("form")? is" plural "."
;
for instance.
Best regards and thank you,
Gustavo Cabral
|
|
|
Powered by
FUDForum. Page generated in 0.03175 seconds