GnuCOBOL

Last updated

GnuCOBOL
Original author(s) Keisuke Nishida, Roger While
Developer(s) Edward Hart, Sergey Kashyrin, Ron Norman, Simon Sobisch and many others.
Initial release25 January 2002;22 years ago (2002-01-25)
Stable release
3.2 [1]   OOjs UI icon edit-ltr-progressive.svg / 28 July 2023;7 months ago (28 July 2023)
Repository sf.net/p/gnucobol/code
Written in C, with a C++ branch
Size 2 MB
Available inEnglish, German, Italian, Japanese, Spanish
Type Programming language
License GPL with runtime libraries under LGPL
Website gnu.org/software/gnucobol

GnuCOBOL (formerly OpenCOBOL, and for a short time known as GNU Cobol) is a free implementation of the COBOL programming language. GnuCOBOL is a transcompiler to C which uses a native C compiler. [2] Originally designed by Keisuke Nishida, the lead development was taken up by Roger While. The most recent developments are now led by Simon Sobisch, Ron Norman, Edward Hart, Sergey Kashyrin and many others. [3]

Contents

History

While working with Rildo Pragana on TinyCOBOL, Keisuke Nishida decided to attempt a COBOL compiler suitable for integration with GCC. This soon became the OpenCOBOL project. Nishida worked as the lead developer until 2005 and version 0.31. Roger While then took over as lead and released OpenCOBOL 1.0 on 27 December 2007. Work on the OpenCOBOL 1.1 pre-release continued until February 2009. In May 2012, active development was moved to SourceForge, and the pre-release of February 2009 was marked as a release. [4] In late September 2013, OpenCOBOL was accepted as a GNU Project, renamed to GNU Cobol, and then finally to GnuCOBOL in September 2014. [5] Ron Norman has added a Report Writer module as a branch of GnuCobol 2.0, and Sergey Kashyrin has developed a version that uses C++ intermediates instead of C. [6]

Transfer of copyrights to the Free Software Foundation over GnuCOBOL source code (including versions with GNU Cobol and OpenCOBOL spellings) was finalized on 17 June 2015. [7]

The latest current release is v3.2, which was released on 28 July 2023.

Philosophy

While striving to keep in line with COBOL Standards up to the current COBOL 2014 specification, and also to include features common in existing compilers, the developers do not claim any level of standards conformance. [8] Even so, the 2.2 final release passes over 9,688 (99.79%) of the tests included in the NIST COBOL 85 test suite, out of 9,708 (as 20 are deleted). [9]

GnuCOBOL translates a COBOL program (source code) into a C program. The C program can then be compiled into the actual code used by the computer (object code) or into a library where other programs can call (link to) it. Under UNIX and similar operating systems (such as Linux), the GNU C compiler is used. For Windows, Microsoft’s Visual Studio Express package provides the C compiler. The two step compilation is usually performed by a single command, but an option exists to allow the programmer to stop compilation after the C code has been generated. [10]

Documentation

The opencobol.org site was the official home of the development team from 2002 until 2012, and was the best source of upstream development information. [11] However, all recent[ when? ] developments are now taking place within a SourceForge project space at GnuCOBOL.

The GnuCOBOL Programmer's Guide, by Gary Cutler, was published under the GNU Free Documentation License. [10] It has been updated to include GnuCOBOL with Report Writer and is listed in the GnuCOBOL documentation overview page with latest versions in the code tree. [12] It is maintained by Vincent Coen and others as each new compiler version is issued and is available at GnuCOBOL - GNU Project.

Example programs

Historical

000100* HELLO.COB GnuCOBOL example000200IDENTIFICATIONDIVISION.000300PROGRAM-ID.hello.000400PROCEDUREDIVISION.000500DISPLAY "Hello, world!".000600STOPRUN.

Compilation and execution:

$ cobc-xHELLO.COB $ ./HELLO Hello, world!

Modern, free format

*> GnuCOBOL Hello World exampleiddivision.program-id.hello.proceduredivision.display "Hello, world!"end-displaygoback.

Compilation and execution:

$ cobc-x-freehello.cob $ ./hello Hello, world!

Shortest

The shortest valid COBOL program, with the relaxed syntax option in GnuCOBOL 2.0, is a blank file. Compilation and execution:

$ cobc-x-frelax-syntax./empty.cob ./empty.cob: 1: Warning: PROGRAM-ID header missing - assumed$ ./empty $

For earlier versions and with relaxed syntax:

display"Hello, world!".

Compilation and execution:

$ cobc-x-frelax-syntax-freehello.cob hello.cob: 1: Warning: PROGRAM-ID header missing - assumedhello.cob: 1: Warning: PROCEDURE DIVISION header missing - assumed$ ./hello Hello, world!

Without relaxed syntax and with any version of GnuCOBOL, GNU Cobol or OpenCOBOL. (Note, there are 7 leading spaces to conform to FIXED layout COBOL source):

program-id.h.proceduredivision.display "Hello, world!".

Compilation occurs without errors:

$ cobc-xsmallest.cob $ ./smallest Hello, world!

Please note that these trivia listings are not to be regarded as good COBOL form; COBOL was designed to be a readable English programming language.

Implementation

The parser and lexical scanner use Bison and Flex. The GPL licensed compiler and LGPL licensed run-time libraries are written in C and use the C ABI for external program linkage.

Build packaging uses the GNU Build System. Standard tests with make check use Autoconf, ANSI85 testsuite run by make test use Perl scripts.

The configure script that sets up the GnuCOBOL compile has options that include:

Availability

Related Research Articles

<span class="mw-page-title-main">GNU</span> Free software collection

GNU is an extensive collection of free software, which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operating systems popularly known as Linux. Most of GNU is licensed under the GNU Project's own General Public License (GPL).

A "Hello, World!" program is generally a simple computer program which outputs to the screen a message similar to "Hello, World!" while ignoring any user input. A small piece of code in most general-purpose programming languages, this program is used to illustrate a language's basic syntax. A "Hello, World!" program is often the first written by a student of a new programming language, but such a program can also be used as a sanity check to ensure that the computer software intended to compile or run source code is correctly installed, and that its operator understands how to use it.

<span class="mw-page-title-main">Liberty BASIC</span>

Liberty BASIC (LB) is a commercial computer programming language and integrated development environment (IDE). It has an interpreter, developed in Smalltalk, which recognizes its own dialect of the BASIC programming language. It runs on 16- and 32-bit Windows and OS/2.

<span class="mw-page-title-main">Source Mage</span> Linux distribution

Source Mage is a source-based Linux distribution descended from Sorcerer. Components of this operating system are downloaded as source code and compiled locally on the user's computer.

In software development, Make is a build automation tool that builds executable programs and libraries from source code by reading files called makefiles which specify how to derive the target program. Though integrated development environments and language-specific compiler features can also be used to manage a build process, Make remains widely used, especially in Unix and Unix-like operating systems.

The Debian Free Software Guidelines (DFSG) is a set of guidelines that the Debian Project uses to determine whether a software license is a free software license, which in turn is used to determine whether a piece of software can be included in Debian. The DFSG is part of the Debian Social Contract.

A compile farm is a server farm, a collection of one or more servers, which has been set up to compile computer programs remotely for various reasons. Uses of a compile farm include:

Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.

The GNU Assembler, commonly known as gas or as, is the assembler developed by the GNU Project. It is the default back-end of GCC. It is used to assemble the GNU operating system and the Linux kernel, and various other software. It is a part of the GNU Binutils package.

<span class="mw-page-title-main">FreeBASIC</span> BASIC dialect

FreeBASIC is a free and open source multiplatform compiler and programming language based on BASIC licensed under the GNU GPL for Microsoft Windows, protected-mode MS-DOS, Linux, FreeBSD and Xbox. The Xbox version is no longer maintained.

<span class="mw-page-title-main">Mathomatic</span> Computer algebra system

Mathomatic is a free, portable, general-purpose computer algebra system (CAS) that can symbolically solve, simplify, combine and compare algebraic equations, and can perform complex number, modular, and polynomial arithmetic, along with standard arithmetic. It does some symbolic calculus (derivative, extrema, Taylor series, and polynomial integration and Laplace transforms), numerical integration, and handles all elementary algebra except logarithms. Trigonometric functions can be entered and manipulated using complex exponentials, with the GNU m4 preprocessor. Not currently implemented are general functions like f(x), arbitrary-precision and interval arithmetic, and matrices.

<span class="mw-page-title-main">Tiny C Compiler</span> Compiler for the C programming language

The Tiny C Compiler is an x86, X86-64 and ARM processor C compiler initially written by Fabrice Bellard. It is designed to work for slow computers with little disk space. Windows operating system support was added in version 0.9.23. TCC is distributed under the GNU Lesser General Public License.

gNewSense Linux distribution

gNewSense was a Linux distribution, active from 2006 to 2016. It was based on Debian, and developed with sponsorship from the Free Software Foundation. Its goal was user-friendliness, but with all proprietary and non-free software removed. The Free Software Foundation considered gNewSense to be composed entirely of free software.

The Heirloom Project is a collection of traditional Unix utilities. Most of them are derived from original Unix source code, as released as open-source by Caldera and Sun.

<span class="mw-page-title-main">GNU Emacs</span> GNU version of the Emacs text editor

GNU Emacs is a free software text editor. It was created by GNU Project founder Richard Stallman, based on the Emacs editor developed for Unix operating systems. GNU Emacs has been a central component of the GNU project and a flagship project of the free software movement. Its tag line is "the extensible self-documenting text editor."

XBLite is a free Open Source BASIC programming language compiler and development system. It was started in 2001 by David Szafranski in order to provide a Windows exclusive version of the XBasic dialect. XBLite is released under the GNU GPL licensing scheme, Standard libraries are released under the GNU LGPL licensing scheme.

<span class="mw-page-title-main">GNU Guix</span> Purely functional package manager for the GNU system

GNU Guix is a functional cross-platform package manager and a tool to instantiate and manage Unix-like operating systems, based on the Nix package manager. Configuration and package recipes are written in Guile Scheme. GNU Guix is the default package manager of the GNU Guix System distribution.

Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTSTEP operating system. Due to Apple macOS’s direct lineage from NeXTSTEP, Objective-C was the standard programming language used, supported, and promoted by Apple for developing macOS and iOS applications until the introduction of the Swift programming language in 2014.

<span class="mw-page-title-main">Nim (programming language)</span> Programming language

Nim is a general-purpose, multi-paradigm, statically typed, compiled high-level systems programming language, designed and developed by a team around Andreas Rumpf. Nim is designed to be "efficient, expressive, and elegant", supporting metaprogramming, functional, message passing, procedural, and object-oriented programming styles by providing several features such as compile time code generation, algebraic data types, a foreign function interface (FFI) with C, C++, Objective-C, and JavaScript, and supporting compiling to those same languages as intermediate representations.

References

  1. Simon Sobisch (28 July 2023). "Release of GnuCOBOL 3.2" . Retrieved 29 July 2023.
  2. "README". ftp.gnu.org.
  3. Tiffin, Brian (19 October 2013). "OpenCOBOL FAQ". What is the development history of OpenCOBOL?. Retrieved 13 December 2013.
  4. Tiffin, Brian (19 October 2013). "OpenCOBOL FAQ". What is the current version of OpenCOBOL?. Retrieved 13 December 2013.
  5. Tiffin, Brian. "GNU Cobol is now a real thing". Archived from the original on 5 October 2013. Retrieved 1 October 2013.
  6. Sobisch, Simon (6 November 2013). "Work in Progress". GNU Cobol 2.0 C++. Archived from the original on 10 May 2020. Retrieved 11 May 2014.
  7. Tiffin, Brian. "State of the Project". Archived from the original on 7 March 2016. Retrieved 23 July 2015.
  8. "OpenCOBOL FAQ". 17 October 2013. How complete is OpenCOBOL?. Retrieved 7 June 2014. While OpenCOBOL can be held to a high standard of quality and robustness, the authors DO NOT claim it to be a "Standard Conforming" implementation of COBOL.
  9. "OpenCOBOL FAQ". Does OpenCOBOL pass the NIST Test Suite?. Retrieved 9 October 2013.
  10. 1 2 Cutler, Gary. "OpenCOBOL Programmer's Guide" (PDF). Opencobol.addltocobol.com. Retrieved 20 November 2012.
  11. "An open-source COBOL compiler". OpenCOBOL. Retrieved 20 November 2012.
  12. Cutler, Gary. "GnuCOBOL Guides". Opencobol.addltocobol.com. Retrieved 22 July 2015.
  13. "GnuCOBOL - Browse Files at". Sourceforge.net. 27 December 2007. Retrieved 28 October 2015.
  14. GnuCOBOL downloads at SourceForge
  15. GnuCOBOL downloads at SourceForge
  16. "Debian -- Details of package open-cobol in buster". packages.debian.org.
  17. GnuCOBOL downloads at SourceForge