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

From version 6.1
edited by cds
on 2012/11/20 13:22
Change comment: There is no comment for this version
To version 4.1
edited by cds
on 2012/11/19 15:50
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -31,15 +31,15 @@
31 31  Add a method to your class that starts the code generation. It can look something like this:
32 32  
33 33  {{code}}
34 -/**
35 - * Generates Java code for the given imperative program.
36 - *
37 - * @param program the imperative program to generate code for.
38 - * @return code that implements the imperative program.
39 - */
40 -def String generateCode(Program program) '''
41 - YOUR CODE GENERATION
42 -'''
34 + /**
35 + * Generates Java code for the given imperative program.
36 + *
37 + * @param program the imperative program to generate code for.
38 + * @return code that implements the imperative program.
39 + */
40 + def String generateCode(Program program) '''
41 + YOUR CODE GENERATION
42 + '''
43 43  {{/code}}
44 44  )))
45 45  1. Decide, which programming language to generate code for. The easiest will probably be Java, but other languages should be fine too. Your code is supposed to generate code that is complete and compilable in your target language. Make sure that your code generation supports transformed Turing Machines as well as the sample programs we provide below.
... ... @@ -54,10 +54,6 @@
54 54  
55 55  As in the previous tutorial, add a menu contribution to the {{code language="none"}}...compiler.ui{{/code}} plug-in to make the code generation available in the interface. Since your code generation implementation is expected to work for arbitrary (valid) instances of the programming language model, your menu contribution should be available for all programming language models and their textual representations. (".imperative" and ".pseudo" files) As in the previous tutorial, your handler should create a new file in the same directory as the input file and refresh the folder afterwards to have the file show up in the project explorer.
56 56  
57 -{{note title="File Names"}}
58 -When working on your menu contribution, think about how to name the files the generated code will be stored in. If your target language is C, the file name doesn't matter much (as long as it has the .c file extension). If your target language happens to be Java, however, the file name makes quite a bit of a difference...
59 -{{/note}}
60 -
61 61  == Testing Your Implementation ==
62 62  
63 63  {{warning title="ToDo"}}
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -3604721
1 +3604711
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/3604721/Code Generation with Xtend
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/3604711/Code Generation with Xtend