What's the relationshiop between Xtext and ANTLR?

拥有回忆 提交于 2020-01-03 08:09:05

问题


I heard that Xtext ultimately uses ANTLR but their grammar specification files have somewhat different formats. So what's the relationship between the two?


回答1:


Xtext relies on the Antlr parser generator for the parsing of input files. On top of that the framework provides lot's of added value such as strongly typed ASTs, abstractions for linking and static analysis as well as IDE integration for Eclipse.

For that purpose, Xtext generates two Antlr grammars. One for the production parsing where the actual AST is produced, and a second grammar that is used to consume events to compute the content proposals for the Eclipse editor.




回答2:


ANTLR grammar is generated from Xtext. You may find it in src-gen/org/example/dsl/parser/antlr/internal/InternalDsl.g.



来源:https://stackoverflow.com/questions/8672144/whats-the-relationshiop-between-xtext-and-antlr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!