Chapter 10. Using the deployed DSL environment

Now that we've set everything up correctly, it's time for testing the whole! This last step describes the way you use your DSL within an eclipse workbench.

  1. Start a new eclipse worbench Run > Run Configuration > new Eclipse application

  2. Create a simple project and name it example

  3. Go to File > New > EMFText > EMFText .logo file and create a file carre.logo in this newly created project.

  4. Type in the example code below to tell the turtle to draw a square. If you get some errors, hit CtrlSpace and enjoy the built-in context assistant to help you resolving them.

    to carre :size 
    	Repeat 4 [
    		
    			Forward :size 
    			Right 90 
    		]
    end 
    Clear 
    PenDown 
    carre ( 50 ) 
    PenUp 

    Save your program and right-click on it and choose Logo > Logo to logoasm in our created pop-up menu. Look at your project directory : a new file carre.logoasm was created.

  5. Rihgt-click on the file carre.logoasm and select Logo > Run Logo Simulator.

    You should see our graphical representation of a turtle drawing a square like in section 7.4.2.

  6. As you can see in the popup menu there are other available actions that we've defined early inside the extension of the plugin.xml file. Now if you want to compile, right clic on the file carre.logoasm, and choose Generate NXC Code (If you want an xmi version you can hit "File > Save" to save your file in .xmi type). You should see a newly created file carre.nxc which is a C-like language containing the instructions.

    [Note]Note

    For some reason (an uri converter, path setup, ..) some may not find the *.nxc file inside their project but into a folder "platform:" and its subfolder in their workspace. You should manually copy it into your workspace

  7. From that .nxc file, you can convert it to a binary file ".rxe" one by choosing Logo > Compile to NXT Binary. Finally you got a ".rxe" that you can upload by bluetooth to your Logo turtle device by the same menu Logo > Upload RXE. If the above submenu doesn't show, see the caution below.

    [Caution]Caution

    For this last step, you need to set up a corresponding environment (which is not covered by the target of this tutorial) if you want to implement the compiler.

    Maybe you need to check out the solution that we provide in the conclusion in order to succesfully achieve this last step and see the complete version including the linux, macos, and windows integration. Additionally, you may also follow instructions inside lib/INSTALL.rxtx inside the project org.kermeta.kmlogo.logoasm.ui.osspecific.