Skip to content

Prototype of an incremental Cobol compiler front-end for IBM Enterprise Cobol 5.1 for zOS syntax.This prototype is a work in progress and is currently written in C#.

License

osmedile/TypeCobol

 
 

Repository files navigation

Build status

TypeCobol

TypeCobol is two things:

  • An open source Cobol 85 incremental parser (+Typedef of Cobol 2002)
    • We are working on a implemention of LanguageServer Protocol to plug our paser with RDZ
  • An extension of Cobol 85 language which can then be converted to Cobol 85
    • Like TypeScript with JavaScript

Open source parser

Our parser is based on IBM Enterprise Cobol 5.1 for zOS syntax. We'll certainly implement IBM Enterprise Cobol 6 next year.

This parser can be used :

Extension of Cobol 85 syntax

TypeCobol extends Cobol 85 with the following features:

  • Type mechanism (like TypeDef of Cobol 2002)
    • TypeCobol comes with intrinsic types: Boolean, Date, ...
  • Procedures :
    • Procedure looks like nested program but with shorter syntax and parameters are clearly categorized as input, in-out or output
    • Arguments of a procedure must match between Caller and procedure signature
    • We support procedures overloading
  • Operator :: which allow to qualify a variable starting with the top most variable
    • Same behavior as operators of and in, but you have to start with the parent variable

TypeCobol code is then translated to Cobol 85 compliant with IBM Enterprise Cobol 5.1 for zOS syntax.

Integration with IDE

We provide minimal integration with RDZ.

We also have an integration with RDZ and our LanguageServer. This is still a work in progress and the RDZ plugin is currently private. Maybe this will change in the future.

The LanguageServer allows us to provide:

  • Errors in real time as you type your code
  • Code completion for Type, variables, procedures and operator ::
  • Go to a definition of a variable

Project status and documentation

This project is currently maintained by 4 persons and our company starts to use it since July 2017.

The documentation is still very limited. If you are interested don't hesitate to contact us so we can give you more information.

Architecture overview

Visual Studio solution and projects

The solution was uploaded to Github using Visual Studio 2015 Community RC and the GitHub Extension for Visual Studio.

The best way to test this project is to download and install both tools (for free) on your local machine, login to Github from Visual Studio Team Explorer, then refresh this page and click on the Open in Visual Studio button which should appear on the right of the repository : this action will clone the solution in your local Git repository and open it in Visual Studio.

The solution contains 4 projects :

  • TypeCobol is the main project, it implements a complete Cobol compiler front-end
  • TypeCobol.Grammar uses Antlr4 to generate C# parsers for Cobol compiler directives and Cobol statements
  • TypeCobol.Test provides unit tests which can be launched from the Test Explorer in Visual Studio
  • TypeCobolStudio is a sample code editor used for visual demos

Dependencies on third party librairies

The following librairies are included in the Visual Studio projects by the Nuget package manager :

  • ANTLR 4 : The C# target of the ANTLR 4 parser generator for Visual Studio 2010+ projects.

  • ANTLR 4 Runtime : The runtime library for parsers generated by the C# target of ANTLR 4. This package supports projects targeting .NET 2.0 or newer, and built using Visual Studio 2008 or newer.

  • Reactive Extensions - Main Library : Reactive Extensions Main Library combining the interfaces, core, LINQ, and platform services libraries. The Reactive Extensions (Rx) is a library to compose asynchronous and event-based programs using observable collections and LINQ-style query operators.

  • System.Collections.Immutable : This package provides collections that are thread safe and guaranteed to never change their contents, also known as immutable collections. Like strings, any methods that perform modifications will not change the existing instance but instead return a new instance. For efficiency reasons, the implementation uses a sharing mechanism to ensure that newly created instances share as much data as possible with the previous instance while ensuring that operations have a predictable time complexity.

  • AvalonEdit : AvalonEdit is a WPF-based text editor component. It was written by Daniel Grunwald for the SharpDevelop IDE. Starting with version 5.0, AvalonEdit is released under the MIT license.

About

Prototype of an incremental Cobol compiler front-end for IBM Enterprise Cobol 5.1 for zOS syntax.This prototype is a work in progress and is currently written in C#.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • COBOL 80.1%
  • C# 16.5%
  • ANTLR 3.4%