Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The generated code includes some automatic validation of models with respect to syntactic issues. If the token sequence in a text file does not conform to the grammar, error markers are shown at appropriate points in the text. However, this should be augmented by semantic validation by checking high-level properties of the model. Implement such a semantic validation by editing the generated file BrainfuckValidator in the validation subpackage. Learn how this is done by reading the Xtext reference documentation →Runtime Concepts → Validation → Custom Validation. Implement at least the following checks:

  • Does every [ has a corresponding closing bracket?
  • Does every ] has a corresponding opening bracket?...
  • ...
Info
titleXtend

In current versions of Xtext, the validator file in the validation subpackage will be an Xtend file. If you do not know how to work with Xtend (and you don't want to experiment with it on your own), you can simple delete the Xtend file and add a BrainfuckValidator.java to the package. The BrainfuckValidator class should extend AbstractBrainfuckValidator.

...

  1. Dive deeper into the rich Xtext documentation: http://www.eclipse.org/Xtext/
  2. Perform our second Xtext tutorial: Xtext I (long tutorial)- Creating a Grammar for an Existing Metamodel
  3. Go on with our Xtend tutorial:

...