Changes for page Code Generation with Xtend
Last modified by Richard Kreissig on 2025/01/30 12:03
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
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 GENERATION42 - '''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,6 +54,10 @@ 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 + 57 57 == Testing Your Implementation == 58 58 59 59 {{warning title="ToDo"}}
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -360471 11 +3604721 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/360471 1/Code Generation with Xtend1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/3604721/Code Generation with Xtend