参考:
https://www.eclipse.org/Xtext/documentation/102_domainmodelwalkthrough.html
https://blog.csdn.net/donhao/article/details/7182792
关键步骤:
- Create A New Xtext Project
- 在xxx.xtext文件中写语法解析
- 在xxx.xtext中右键菜单Run As → Generate Xtext Artifacts.
- 在project节点右键菜单Run As → Eclipse Application, 会启动一个新的Eclipse
- 在新启动的Eclipse创建一个java的project,并在这个project里追加个*.dmodel文件. 文件内容如下,keyword已经能够识别。
datatype String
entity Blog {
title: String
many posts: Post
}
entity HasAuthor {
author: String
}
entity Post extends HasAuthor {
title: String
content: String
many comments: Comment
}
entity Comment extends HasAuthor {
content: String
}