售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Implementing Domain-Specific Languages with Xtext and Xtend - Second Edition
Table of Contents
Implementing Domain-Specific Languages with Xtext and Xtend - Second Edition
Credits
Foreword
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
Preface to the second edition
1. Implementing a DSL
Domain-Specific Languages
Need for a new language
Implementing a DSL
Parsing
The Abstract Syntax Tree (AST)
IDE integration
Syntax highlighting
Background validation
Error markers
Content assist
Hyperlinking
Quickfixes
Outline
Automatic build
Summarizing DSL implementation
Enter Xtext
Installing Xtext
Let's try Xtext
The aim of this book
Summary
2. Creating Your First Xtext Language
A DSL for entities
Creating the project
Xtext projects
Modifying the grammar
Let's try the Editor
The Xtext generator
The Eclipse Modeling Framework (EMF)
Improvements to the DSL
Dealing with types
Summary
3. Working with the Xtend Programming Language
An introduction to Xtend
Using Xtend in your projects
Xtend – a better Java with less "noise"
Types
Methods
Fields and Variables
Operators
Syntactic sugar
Static members and inner types
Literals
Extension methods
The implicit variable – it
Lambda expressions
Multi-line template expressions
Additional operators
Polymorphic method invocation
Enhanced switch expressions
Other Xtend expressions
Xtend IDE
Debugging Xtend code
Summary
4. Validation
Validation in Xtext
Default validators
Custom validators
Quickfixes
Textual modification
Model modification
Quickfixes for default validators
Summary
5. Code Generation
Introduction to code generation
Writing a code generator in Xtend
Integration with the Eclipse build mechanism
Standalone command-line compiler
Summary
6. Customizing Xtext Components
Dependency injection
Google Guice in Xtext
Customizations of IDE concepts
Labels
The Outline view
Customizing other aspects
Custom formatting
Other customizations
Summary
7. Testing
Introduction to testing
JUnit 4
The ISetup interface
Implementing tests for your DSL
Testing the parser
Testing the validator
Testing the formatter
Testing code generation
Test suite
Testing the UI
Testing the content assist
Testing workbench integration
Testing the editor
Learning Tests
Testing the outline
Other testing frameworks
Testing and modularity
Clean code
Summary
8. An Expression Language
The Expressions DSL
Creating the project
Digression on Xtext grammar rules
The grammar for the Expressions DSL
Left recursive grammars
Associativity
Precedence
The complete grammar
Forward references
Custom Content Assist
Typing expressions
Loose type computation, strict type checking
Type computer
Validator
Writing an interpreter
Using the interpreter
Optimizations and fine tuning
Summary
9. Type Checking
SmallJava
Creating the project
SmallJava grammar
Rules for declarations
Rules for statements and syntactic predicates
Rules for expressions
Rule fragments
The complete grammar
Utility methods
Testing the grammar
First validation rules
Checking cycles in class hierarchies
Checking member selections
Checking return statements
Checking for duplicates
Type checking
Type computer for SmallJava
Type conformance (subtyping)
Expected types
Checking type conformance
Checking method overriding
Improving the UI
Summary
10. Scoping
Cross-reference resolution in Xtext
Containments and cross-references
The index
Qualified names
Exported objects
The linker and the scope provider
Component interaction
Custom scoping
Scope for blocks
Scope for inheritance and member visibility
Visibility and accessibility
Filtering unwanted objects from the scope
Global scoping
Packages and imports
The index and the containers
Checking duplicates across files
Providing a library
Default imports
Using the library outside Eclipse
Using the library in the type system and scoping
Classes of the same package
Dealing with super
What to put in the index?
Additional automatic features
Providing a project wizard
Summary
11. Continuous Integration
Eclipse features and p2 repositories
Release engineering
Headless builds
Target platforms
Continuous integration
Introduction to Maven/Tycho
Using the Xtext project wizard
Running the Maven build
Customizing the feature
Using and customizing the target platform
Customizing the pom files
Continuous Integration systems
Maintaining the examples of this book
Your DSL editor on the Web
IntelliJ and Gradle
Pitfalls with Maven/Tycho
Versioning
PDE test problems
Concluding remarks
Installation requirements
Make contributions easy
Summary
12. Xbase
Introduction to Xbase
The common Java type model
The Expressions DSL with Xbase
Creating the project
The IJvmModelInferrer interface
Code generation
Debugging
The Entities DSL with Xbase
Creating the project
Defining attributes
Defining operations
Imports
Validation
Additional Xbase features
Annotations
Reusing Java error markers
Using 'extension'
Using type parameters
Formatter
Further Customizations
Summary
13. Advanced Topics
Creating an Xtext project from an Ecore model
Defining the Ecore model
Creating the Xtext project
Fixing the StandaloneSetup
Tweaking the Ecore model
Derived State
Adding new rules to the language
Switching to an imported Ecore model
Generating EMF classes during the build
Customizing the EMF Java classes
Xcore
Creating the Xcore project
Creating the Xtext project from an existing Xcore model
Modifying the Xcore model
Extending Xbase
Overriding a rule in an Xtext grammar
Customizing the type system
Testing the type computer
Customizing the validator
Customizing the compiler
Using the type system in the compiler
Testing the compiled code
Improving code generation
Smoke tests
Summary
14. Conclusions
A. Bibliography
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜