Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Implementing Domain-Specific Languages with Xtext and Xtend

You're reading from   Implementing Domain-Specific Languages with Xtext and Xtend If you know Eclipse then learning how to implement a DSL using Xtext is a natural progression. And this guide makes it easy to get started through a step-by-step approach accompanied with simple examples.

Arrow left icon
Product type Paperback
Published in Aug 2013
Publisher Packt
ISBN-13 9781782160304
Length 342 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Lorenzo Bettini Lorenzo Bettini
Author Profile Icon Lorenzo Bettini
Lorenzo Bettini
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Implementing Domain-Specific Languages with Xtext and Xtend
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Implementing a DSL 2. Creating Your First Xtext Language FREE CHAPTER 3. The Xtend Programming Language 4. Validation 5. Code Generation 6. Customizations 7. Testing 8. An Expression Language 9. Type Checking 10. Scoping 11. Building and Releasing 12. Xbase 13. Bibliography
Index

Standalone command-line compiler


We already know that the Xtext project wizard created the projects for our DSL separating the features related to the user interface in a separate project (the .ui project); the runtime project does not depend on the Eclipse user interface. Thus, we can create a command-line application consisting of a simple Java class with a main method. Simply add the following lines to your MWE2 workflow file:

// generator API
fragment = generator.GeneratorFragment {
  generateJavaMain = true
}

If you now run the workflow, you will find a Main class in the src folder of your project in the org.example.entities.generator package. As you may recall from Chapter 2, Creating Your First Xtext Language, files generated into the src folder are only generated once (if they do not exist) and thus you can safely add/modify the logic of the Main class. This is not required at this point; we will use the class as it was generated. You do not have to worry about not understanding everything...

lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Implementing Domain-Specific Languages with Xtext and Xtend
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon