简体   繁体   中英

Extending the Xbase type system

I have this simple DSL, inspired from the mini-java example but based on XBase. See below to take a quick look at my grammar.

Package returns Package:
{Package}
'package'
name = QualifiedName
(importSection = XImportSection)?
(classifiers += Classifier)*
;

Classifier returns Classifier : 
Class 
| DataType 
| Enum
;

Class returns Class:
{Class}
((abstract?='abstract'? 'class') | interface?= 'interface') name = ID
('<' typeParameters+=JvmTypeParameter (',' 
typeParameters+=JvmTypeParameter)* '>')?
('extends' superType=JvmParameterizedTypeReference)?
'{'
   (members+=Member)*
'}'
 ; ...

My question is as follows:

How can I extend the XBase type system in order to recognize type conformance between a super-class and a sub-class defined with this simple DSL?!

I've spent a couple of days looking for examples out there, but I couldn't put my hands on one clear example.

Thanks you in advance for any hint, help!

Cheers,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM