Class CodeProgramCompiler

java.lang.Object
dev.zemco.codegame.compilation.CodeProgramCompiler
All Implemented Interfaces:
IProgramCompiler

public class CodeProgramCompiler extends Object implements IProgramCompiler
Implementation of a compiler, which compiles source code into an executable program using the CodeGame syntax. Instructions are parsed using provided instruction parser and the final program is built using provided program builder factory.

CodeGame syntax includes following features:

  • every instruction is exactly one line long
  • every jump label is exactly one line long
  • jump labels are prefixed using '>' and can contain any non-whitespace character
  • comments are prefixed using ';' and end at the end of the line
  • comments are completely ignored during compilation and may be placed behind instructions or jump labels
  • black lines / lines containing only whitespace/comments are completely ignored
  • duplicate jump labels are not allowed
Author:
Erik Zemčík