Cobol For GCC - a GNU project - Free Software Foundation


COBOL For GCC is a project to produce a free COBOL compiler compliant with the COBOL 85 Standard, integrated into the GNU Compiler Collection (GCC).


The purpose of this project is to allow the many millions of COBOL programmers to bring their experience and talent to the world of free software development. However the compiler will also be usable for commercial software development, just as GCC is.

The plan is to get a subset of COBOL going which will enable COBOL programmers to then help with the rest of the project, as well as Lisp and C programmers.

Original Project

The original project, written in C, produced 58,000 lines of code between March 1999 and early 2003. This supported all the COBOL preprocessing including COPY, REPLACE, line continuations etc. Parsing and lexical analysis for the COBOL nucleus done. Integration into GCC had been done, including integration into the GCC code generation back end. Limited code generation via GCC back end had been done including most of the data division. Some of the runtime routines have been done. We estimated another 70,000-150,000 lines of code remained to be written, probably on the high end of that range.

Current Project

The current project started in earnest on 3rd October 2007 with a six-month full-time commitment the project by Tim Josling.

The original project was put in mothballs in 2003. There were a number of issues. The main problems were the difficulty of interfacing to GCC, and the use of C as a development language.

The interface to GCC from language front-ends is complex, poorly documented and volatile. This created a major productivity hit on the developers, who were spending up to half their time making changes to accommodate changes to GCC. One notable example of this was the GCC garbage collection code. Development time was also consumed with various attempts to improve GCC, for example by creating the treelang "toy" language to help other developers who wanted to create a GCC front end.

The current project is attempting to minimize this issue by writing most of the compiler as a separate executable from GCC. This compiler will then pass a binary file across to another executable which will contain a thin interface to the GCC back end. This will also make it easier to interface to other code generation back ends, such as LLVM, or to generate JVM bytes codes or even other high level language source code eg C.

The second issue is the low productivity resulting from developing in C. Completing the development in C was not feasible given the huge amount of code that had to be written. This issue is being addressed by doing most of the development in Lisp. The compiler is being tested with SBCL, CMULISP, and GCL. This will provide coverage for Unix/Linux/BSD as well as other proprietary operating systems such as Microsoft Windows.

See Paul Graham Succinctness is Power for a discussion of the issue of programming language productivity.

The current status of the current project is that work on the code generation has just started. We hope to have a basic subset of COBOL functional by June 2008. The lines of code so far is 17,000, which is a factor of 3 or 4 smaller than the equivalent C code from the original project. This, in spite of the fact that the code includes a Bison back end for Lisp and a complete lexical analyser generator, which together comprise over 3,000 lines of code.

Project Links

The project is currently hosted at You can browse or download the source by following the links below.


The original COBOL for GCC manual is available from the CVS source code. This includes the file Writing a Compiler Front End, written originally by Joachim Nadler and then translated from German and extended. This chapter explains how to write a compiler front end to GCC in 513 not-so-easy steps.

No other documentation is available yet.

Source Code

File modules are available to download from SourceForge Project Main Page for this project

An easy way to look at the source code is to browse the CVS repository. A link to this is available from the main project links page above or directly at

  • Source Code (cvs) Browsing

    You can also check out (download) the source code anonymously using cvs, which is available for Unix and for Microsoft Windows. Use the following commands:

    cd directory_to_put_source (preferably with nothing else in it)
    cvs -z3 co .

    Subsequently you can refresh the source with
    cd directory_to_put_source
    cvs update

    You can also download the original C version using the following command
    cvs -z3 co -r original-c-version .

    More Information

    The project lead is Tim Josling (

    How you can help

    We are not calling for volunteers until the basic functional compiler is done. This should be some time in June 2008.

    People will be needed with skills in Lisp, or C or COBOL. We will write much of the run-time in COBOL. The main compiler will almost all be in Lisp and the GCC interface and some low-level run-time routines will be in C. If an LLVM interface is done (for code generation) this will be done in C++.

    To contribute code, you need to sign a copyright assignment for your code to the Free Software Foundation. You will also need to arrange a waiver to be signed by your employer and/or school or college. This is a mandatory requirement.

    Other Free COBOL Projects

    OpenCOBOL project has been quite active. This is probably the free COBOL compiler that is most functional at the moment.

    Tiny COBOL project has also been quite active, though less so lately. It started mid 1999 using a pre-existing DOS COBOL compiler as a base. They are generating X86 assembler for GNU/Linux. They have considerable functionality and several developers. They are not taking a very strict approach to adherence to the COBOL standard.

    Alberto Santini's COBOL Compiler COBCY (broken link) is currently inactive. The function is fairly limited.

    Cobol2C (broken link) is currently inactive. They did two versions of COBOL compilers, both with limited function. This was previously the 'GNU COBOL' project.

    Other Links

    GCC Central has the GCC code, documentation including the full manual excluding my amendments above, mailing lists etc.

    GCC Central

    COBOL Links

    COBOL Standards Activities

    Free Compiler Links - the Free

    Take the link below to register with SourceForge or to search for projects.
    Source Forge

    Project coordinator's personal home page:

    Tim Josling's Home Page

    Return to GNU's home page.

    Please send FSF & GNU inquiries & questions to There are also other ways to contact the FSF.

    Please send comments on these web pages to, send other questions to

    Copyright (C) 1999, 2001, 2008 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA

    Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

    Updated: 20 Mar 2001 Tim Josling 05 Apr 2008 Tim Josling