Evolving Multi-line Compilable C Programs

  • Michael O’Neill
  • Conor Ryan
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1598)


We describe a Genetic Algorithm called Grammatical Evolution (GE) that can evolve complete programs in an arbitrary language using a variable length linear genome. The binary genome determines which production rules in a Backus Naur Form grammar definition are used in a genotype to phenotype mapping process to a program. Expressions and programs of arbitrary complexity may be evolved using this system.

Since first describing this system, GE has been applied to other problem domains, and during this time GE has undergone some evolution. This paper serves to report these changes, and also describes how we evolved multi-line C-code to solve a version of the Santa Fe Ant Trail. The results obtained are then compared to results produced by Genetic Programming, and it is found that GE outperforms GP on this problem.


Genetic Programming Genetic Code Production Rule Biological Organism Grammatical Evolution 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Elseth Gerald D., Baumgardner Kandy D. Principles of Modern Genetics. West Publishing CompanyGoogle Scholar
  2. 2.
    Fraser Adam, Weinbrenner Thomas. 1997. The Genetic Programming Kernel Version 0.5.2.Google Scholar
  3. 3.
    Freeman, J. J. A Linear Representation for GP using Context Free Grammars. In Proceeding of Genetic Programming 1998, pages 72–77. MIT Press.Google Scholar
  4. 4.
    Horner, H A C++ class library for GP. Vienna University of Economics.Google Scholar
  5. 5.
    Keller, R. E. & Banzhaf, W. 1996. Genetic Programming using Genotype-Phenotype Mapping from Linear Genomes into Linear Phenotypes. In Genetic Programming 1996, pages 116–122. MIT Press.Google Scholar
  6. 6.
    Koza, J. 1992. Genetic Programming. MIT Press.Google Scholar
  7. 7.
    Langdon, W. & Poli, R. Why Ant’s Are Hard. In Proceedings of Genetic Programming 1998, pages 193–201.Google Scholar
  8. 8.
    Levenick, James. R. Inserting Introns Improves Genetic Algorithm Success Rate: Taking a Cue from Biology. In Proceedings of the Fourth International Conference on Genetic Algorithms 1991, pages 123–127.Google Scholar
  9. 9.
    Paterson, N & Livesey, M. 1997. Evolving caching algorithms in C by GP. In Genetic Programming 1997, pages 262–267. MIT Press.Google Scholar
  10. 10.
    Ryan C., Collins J.J., O’Neill M. 1998. Grammatical Evolution: Evolving Programs for an Arbitrary Language. Lecture Notes in Computer Science 1391, Proceedings of the First European Workshop on Genetic Programming, pages 83–95. Springer-Verlag.Google Scholar
  11. 11.
    Ryan C., O’Neill M., Collins J.J. 1998. Grammatical Evolution: Solving Trigonometric Identities. In Proceedings of Mendel ’98: 4th International Conference on Genetic Algorithms, Optimization Problems, Fuzzy Logic, Neural Networks and Rough Sets, pages 111–119.Google Scholar
  12. 12.
    Ryan C., O’Neill M. Grammatical Evolution: A Steady State Approach. In Late Breaking Papers, Genetic Programming 1998, pages 180–185.Google Scholar
  13. 13.
    Whigham, P. 1995. Grammatically-based Genetic Programming. In Proceedings of the Workshop on Genetic Programming: From Theory to Real-World Applications, pages 3–41. Morgan Kaufmann Pub.Google Scholar
  14. 14.
    Wong, M. and Leung, K. 1995. Applying logic grammars to induce subfunctions in genetic programming. In Proceedings of the 1995 IEEE conference on Evolutionary Computation, pages 737–740. USA: IEEE Press.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Michael O’Neill
    • 1
  • Conor Ryan
    • 1
  1. 1.Dept. Of Computer Science And Information SystemsUniversity of LimerickIreland

Personalised recommendations