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
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 :
- as C# API
- with our Command Line interface
- with our LanguageServer Protocol implementation to plug our paser with RDZ (still a work in progress).
- You can also look at our https://github.com/TypeCobolTeam/TypeCobolBuild project which use our C# API from a Java RTC plugin
Extension of Cobol 85 syntax
TypeCobol extends Cobol 85 with the following features:
- Type mechanism (like TypeDef of Cobol 2002)
- 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
::which allow to qualify a variable starting with the top most variable
- Same behavior as operators
in, but you have to start with the parent variable
- Same behavior as operators
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.
Visual Studio solution and projects
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 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.