Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Open-Source COBOL .NET Compiler Otterkit Reaches Alpha

Open-Source COBOL .NET Compiler Otterkit Reaches Alpha

Otterkit is a free and open-source compiler for the COBOL programming language that runs on the .NET platform. It is currently in the alpha stage, under development to implement the COBOL 2023 standard.

The project was launched in November 2022 on GitHub. The project's lead developer is Gabriel Gonçalves, a front-end developer from Rio de Janeiro, Brazil. Right now, there are two other developers actively contributing to the project. Gonçalves explains the inspiration for this project:

Strangely enough, the COBOL Standard itself inspired us to work on a modern Standard COBOL compiler. There are a ton of nice features and improvements in the newer standards that are not available with current compilers, mostly due to vendors focusing too much on legacy support. We probably would never know that COBOL supports generic classes and interfaces if it wasn't for the COBOL Standard. I'd say that it still has a place in a modern ecosystem if you're willing to leave the legacy stuff behind.

InfoQ reached out and ask about a tentative date when Gonçalves could have a standard-complete compiler:

We're almost done working on the parser which hopefully means that we'll soon have a standard-complete parser for the COBOL 2023 standard. For a "complete" compiler, probably by next year but that would depend a lot on if we manage to get community help and more contributors.

He also discussed how the COBOL developer community is reacting to Otterkit:

It's difficult to say, but I'd guess that the reception has been positive (I hope). Difficult to say because as of now we've received more attention from the .NET side of it than the COBOL side of it. We'd like to get more feedback from COBOL developers to figure out if they need support for certain features, but it's difficult to find people who are interested in COBOL today and willing to invest time into it.

The project is still at an early stage. The current version is 1.0.45-alpha, which has limited implementation of the COBOL code syntax. It is released as a NuGet package for .NET 7 runtime, and it can be installed from the command line using dotnet tool CLI. It adds a new command tool called otterkit that can build .NET executable files from COBOL source code.

Otterkit works by transpiling COBOL code into C# .NET code and then compiling it as a standard .NET executable. For example, the following code in COBOL:


Is transpiled into the following .NET code under the hood:

public class _IDSAMPLE
    public void Procedure()
    Statements.DISPLAY(" ", true, "HELLO WORLD", String.Empty);

The compiled executable can be executed on any .NET 7 runtime, which opens the roadmap for COBOL programs running in cloud containers, for example.

Screenshot of the sample COBOL program executing in .NET runtime, writing HELLO WORLD to the output.

COBOL is an old programming language created in 1959 by the US government’s CODASYL committee. However, it is still widely used in banking systems and ATM processing software. It is estimated that 800 billion lines of COBOL are running in production right now, three times more than previously thought.

The project has raised expectations in the .NET community. In early February 2023, the lead developer showcased the Otterkit in the regular .NET Languages and Runtime Community Standup, streamed and recorded on YouTube, together with Microsoft .NET team members Bill Wagner and Immo Landwerth.


About the Author

Rate this Article