简体   繁体   English

扩展Xbase类型系统

[英]Extending the Xbase type system

I have this simple DSL, inspired from the mini-java example but based on XBase. 我有这个简单的DSL,它是从mini-java示例中获得灵感的,但是基于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?! 我如何扩展XBase类型系统,以识别使用此简单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, 干杯,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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