TypeCobol is an Incremental Cobol parser for IBM Enterprise Cobol 5.1 for zOS syntax. TypeCobol is also an extension of Cobol 85 language which can then be converted to Cobol85.
Clone or download
Pull request Compare This branch is 2 commits ahead, 34 commits behind develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
Analytics
CLI
CSCup
CSCupRuntime
Codegen
Documentation
TypeCobol.LanguageServer.Test
TypeCobol.LanguageServer
TypeCobol.Test
TypeCobol.Transform.Test
TypeCobol.Transform
TypeCobol
build
.gitattributes
.gitignore
BuildScript.bat
LICENSE.md
README.md
TypeCobol.sln
_config.yml
appveyor.yml

README.md

Build status

TypeCobol

TypeCobol is two things:

  • An open source Cobol 85 incremental parser (+Typedef of Cobol 2002)
  • An extension of Cobol 85 language (named TypeCobol) 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 in 2018/19.

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 these 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
  • Codegen provides the mechanism to transform TypeCobol code to Cobol 85
  • TypeCobol.LanguageServer implements the LanguageServer protocol
  • TypeCobol.Transform is useful to store the TypeCobol source code and the generated Cobol85 code into one single file.

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.