Last modified by Richard Kreissig on 2025/01/30 12:03

From version 5.1
edited by msp
on 2012/10/31 19:58
Change comment: There is no comment for this version
To version 8.1
edited by msp
on 2012/10/31 21:02
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -48,5 +48,22 @@
48 48  
49 49  * The predefined grammar contains one grammar rule for each meta model class. This general structure can be kept in most cases.
50 50  * Ecore enumerations (EEnum) must be defined with an {{code language="none"}}enum{{/code}} grammar rule (see documentation). This is not correct in the predefined grammar and is marked with a TODO note.
51 +* At some points you will need to reference other elements, which need to have some kind of identifier string in order to do this. If those elements do not have a string attribute yet, you need to modify the meta model and add such an attribute.
52 +* There are some predefined terminal rules that can be reused and are already imported in the grammar file. Click on {{code language="none"}}org.eclipse.xtext.common.Terminals{{/code}} at the top of the document and hit F3 to see those terminal definitions.
51 51  
52 -
54 +Test the new grammar by re-generating the code (after the first time, the GenerateTuring workflow should be available in the run configurations menu) and starting a test instance of Eclipse. Use your newly designed textual syntax for writing a Turing Machine that copies the input word infinitely often.
55 +
56 += Formatting =
57 +
58 +Xtext supports automatic formatting, which is available in the text editor with right-click → //Format// or ctrl+shift+F. However, the formatter must be configured in order to generate good results. Write a formatter configuration that fits well to your syntax by editing the generated file {{code language="none"}}TuringFormatter{{/code}} in the {{code language="none"}}formatting{{/code}} subpackage. Learn how this is done by reading the Xtext reference documentation → Runtime Concepts → Formatting.
59 +
60 += Validation =
61 +
62 +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 {{code language="none"}}TuringJavaValidator{{/code}} in the {{code language="none"}}validation{{/code}} subpackage. Learn how this is done by reading the Xtext reference documentation → Runtime Concepts → Validation → Custom Validation. You should implement at least the following checks:
63 +
64 +* Is there exactly one initial state?
65 +* Are all states reachable through transitions starting from the initial state?
66 +
67 += Parsing =
68 +
69 +The generated code includes a parser for text files in your syntax. This parser is simply used with the same interface as for any other EMF models: resource sets.
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -2982418
1 +2982424
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982418/Textual Modeling with Xtext
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982424/Textual Modeling with Xtext