<
From version < 14.3 >
edited by cds
on 2023/07/19 11:50
To version < 15.1 >
edited by Richard Kreissig
on 2023/09/06 14:18
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.cds
1 +XWiki.stu230980
Content
... ... @@ -12,7 +12,7 @@
12 12  
13 13  1. Install the //Xtext Antlr Runtime Feature// from [[http:~~/~~/download.itemis.de/updates/>>url:http://download.itemis.de/updates/||shape="rect"]] (click //Help// → //Install New Software...// and enter the URL into the topmost text field; once Eclipse has downloaded the list of software available under that URL, select the feature from the list)
14 14  1. //File// → //New// → //Project...// → //Xtext// → //Xtext Project From Existing Meta Models// → //Next// → //Add...// → turing.genmodel → //OK//
15 -1. Select your top-level model element as "//Entry rule//", e.g. //TuringMachine// → //Next// → enter the following values:\\
15 +1. Select your top-level model element as "//Entry rule//", e.g. //TuringMachine// → //Next// → enter the following values:
16 16  1*. //Project name~:// de.cau.cs.rtprak.login.turing.text (like in previous tutorials, replace "login" by your login name)
17 17  1*. //Location~:// your repository path
18 18  1*. //Name~:// de.cau.cs.rtprak.login.turing.text.Turing
... ... @@ -25,7 +25,7 @@
25 25  1. (((
26 26  Use ctrl + space for getting content assist to create a valid model following the predefined grammar. The syntax will probably look similar to this:
27 27  
28 -{{noformat}}
28 +{{code}}
29 29  TuringMachine {
30 30   states {
31 31   State blub {
... ... @@ -39,7 +39,7 @@
39 39   }
40 40   }
41 41  }
42 -{{/noformat}}
42 +{{/code}}
43 43  )))
44 44  
45 45  The predefined grammar is not very nice. That's why now your creative part comes into play. Change the Xtext grammar file to a grammar of your liking, which should support a simple and readable syntax for Turing Machines. All required documentation for this task is found at [[http:~~/~~/www.eclipse.org/Xtext/>>url:http://www.eclipse.org/Xtext/||shape="rect"]].
... ... @@ -70,18 +70,18 @@
70 70  
71 71  1. Go to the plugin where you created and registered {{code language="none"}}TuringHeadController{{/code}}, the Turing Machine simulator. Open {{code language="none"}}plugin.xml{{/code}} → //Dependencies// and add org.eclipse.ui if not on the list yet. Go to //Extensions// and add org.eclipse.ui.menus.
72 72  1. Add a //menuContribution// element to the new extension and set "popup:org.eclipse.ui.popup.any?after=additions" as //locationURI// (without quotation marks).
73 -1. Add a //command// element to the //menuContribution// with the following attributes:\\
73 +1. Add a //command// element to the //menuContribution// with the following attributes:
74 74  1*. //commandId: //de.cau.cs.rtprak.login.setSimFile
75 75  1*. //label: //Set Simulation File
76 -1. Add a //visibleWhen// element to the //command//, and add an //iterate// element to the //visibleWhen// with the following attributes:\\
76 +1. Add a //visibleWhen// element to the //command//, and add an //iterate// element to the //visibleWhen// with the following attributes:
77 77  1*. //operator~:// and
78 78  1*. //ifEmpty~:// false
79 -1. Add an //adapt// element to the //iterate// with the following attribute:\\
79 +1. Add an //adapt// element to the //iterate// with the following attribute:
80 80  1*. //type~:// org.eclipse.core.resources.IResource
81 -1. Add a //test// element to the //adapt// with the following attributes:\\
81 +1. Add a //test// element to the //adapt// with the following attributes:
82 82  1*. //property~:// org.eclipse.core.resources.extension
83 83  1*. //value~:// tuxt
84 -1. Add a new extension org.eclipse.ui.commands and add a //command// element to it with the following attributes:\\
84 +1. Add a new extension org.eclipse.ui.commands and add a //command// element to it with the following attributes:
85 85  1*. //id: //de.cau.cs.rtprak.login.setSimFile
86 86  1*. //name: //Set Simulation File
87 87  1*. Click on //defaultHandler// to open a dialog for creation of a new handler class. Name the new class {{code language="none"}}SetFileHandler{{/code}} and put it into some package of that plugin. Remove the suggested interface and set {{code language="none"}}org.eclipse.core.commands.AbstractHandler{{/code}} as superclass instead.
... ... @@ -110,4 +110,3 @@
110 110  1. Use the resource set code shown in the EMF tutorial for loading model files (without the stand-alone part) in order to load the {{code language="none"}}modelFile{{/code}} in the {{code language="none"}}initialize{{/code}} method.
111 111  1. Now you should be able to simulate models written in your textual syntax: start Eclipse, right-click a textual Turing Machine file (*.tuxt), select //Set Simulation File//, and run simulation in your Tape view using the correct controller.
112 112  
113 -\\