Child pages
  • Code Generation with Xtend

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Add a new Xtend Class to the compiler project, preferrably in a new package called de.cau.cs.rtprak.login.compiler.codegen.
  2. Add a method to your class that starts the code generation. It can look something like this:

    Code Block
        /**
         * Generates Java code for the given imperative program.
         * 
         * @param program the imperative program to generate code for.
         * @return code that implements the imperative program.
         */
        def String generateCode(Program program) '''
            YOUR CODE GENERATION
        '''
  3. 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.

...