Xtext什么

在Xtext官方网站是这么说的

“Building your own domain-specific languages has never been so easy. Just put your grammar in place and you not only get the working parser and linker but also first class Eclipse support.”

翻译过来就是说创建你自己的DSL从来没有这么简单过。你仅仅须要写好你的语法,然后剩下的事情交给Xtext来做(包含parser。linker和在Eclipse中的无缝支持)。


想要学习Xtext,你至少须要了解下面技术:

  1. Principles of grammar (parser(left associativity, precedence, etc ) and lexer), EBNF --> Write xtext
  2. Antlr --> generate parser 
  3. mwe2
  4. EMF and Ecore --> in memory expression of model
  5. Dependency Injection and Google Guice.--> put it in together
  6. Developing using Eclipse --> IDE support
  7. Java language, libraries and JVM
  8. Xtend --> one DSL for made Java developer more easy
  9. Xbase --> make write xtext more easy

在进一步之前,先解释一下,什么是DSL,翻译过来就是某一个详细领域的语言。DSL开发人员能够给某一个领域或者行业。开发一种在这个领域或者行业的专家

都能理解的方言。他们意识不究竟层的详细实现,从而来专注于自己的本职工作。提高效率,隔离责任等。


Xtext就是来实现DSL的一个免费开源的项目。

使用Xtext你仅仅须要编写Xtext文件。就是你的DSL的语法。和扩展Xtext提供给你的一些方法,就能够实现一个由Eclipse支持的使用DSL语言的开发环境,

这个环境能够向JDT或或者PDT一样,提供语法高亮。自己主动不全,代码辅助,语法错误检查和改动方法建议等功能。


Xtext的工作流程:

  • 编写Xtext文件
  • 通过mwe2生成全部你须要的代码的基本框架。这个框架就能够执行。

    当中包含EMF须要的Ecore和相应的对象,相应的编辑器,UT測试等。

  • 在执行的过程中,是通过Guice来讲个方面连接起来的

以后有时间的话,我会将各个部分连接起来说一说的。

http://www.euclideanspace.com/software/development/eclipse/xtext/index.htm

版权声明:本文博客原创文章。博客,未经同意,不得转载。

原文地址:https://www.cnblogs.com/lcchuguo/p/4629143.html