Context-Free Grammar GP (CFG-GP)
Whigham demonstrated a grammar based genetic programming approach which he called context-free grammar GP (CFG-GP). EpochX's implementation of CFG-GP is referred to as XGR. (EpochX GRammer GP). XGR takes a BNF grammar as one of its inputs and then evolves parse trees that form syntactically valid source strings according to that grammar.

How these source strings are evaluated in XGR is grammar dependent. In theory, Whigham's technique makes it possible to evolve programs in any language which can be defined in a BNF. However, in practice, it requires a way of evaluating the program snippets in order to assign a fitness score. So in order to evolve Java, Lisp or Ruby code, some form of interpreter for that language is required. EpochX provides a way of plugging in interpreters for different programming languages, and provides interpreters out of the box for the following:

  • Java
  • Ruby
  • Groovy
  • Epox

Of course it is also possible to evaluate a candidate solution manually without an interpreter.


As well as context-free grammar GP, EpochX also supports the popular strongly-typed tree GP and grammatical evolution representations.