简体   繁体   中英

Lightweight use of xtext

For a server application in java I want to allow my users to write some scripts using my own defined Domain specific language. Xtext seems to be what I'm looking for, its way of describing a grammar is easy and allows me to describe the language I need.

My problem is that Xtext looks so heavy weight to me. I need a special eclipse distribution, for testing it starts a new instance of eclipse, I need to write a code generator => overkill.

All I want is something like that

<dependency>
  <groupId>org.something</groupId>
  <artifactId>dslparser</artifactId>
  <version>mature</version>
</dependency>

DslParser parser = new DslParser(myGrammar);
SomeKindOfGenericKModell modell = parser.parse(userInput);

Does Xtext provide that? If yes, is there a tutorial? If not what is the alternative? I took a short look at ANTLR, but as far as I can see it's syntax is not that expressive as xtext's. Is it?

Yes, Xtext does not depend on Eclipse if you don't want to use the UI. It has a dependency to Guice and other libraries, eg Antlr or some Eclipse framework stuff (all UI / OSGi independent) though.

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