The Linux Foundation Projects
Skip to main content
Blog | Mentorship | Zowe

Winter 2025 Mentorship: Building a Rexx Language Server with Langium for Visual Studio Code Development

By | May 7, 2025

Written by Jason Li, Western University Student

Western University is an Academic member of Open Mainframe Project, which offered a winter mentorship to students. Three students joined the Zowe Mentorship led by Uladzislau Kalesnikau. These students share their experience and key learnings in the blogs.  

The Problem 

Having the proper language tooling can significantly improve engineering velocity when working with legacy mainframe systems. Rexx (restructured extended executor) is an open-source, structured programming language released in the 1980s, which has been widely used in mainframe environments. IntelliJ IDEA already has a Rexx plugin created using ANTLR4 instructions. For further development and support of this plugin, it was decided to recreate the functionality of the plugin using Langium. 

This product should be implemented in two stages: 

  1. Create VS Code Extension
  2. Reuse the extension in a plugin for IntelliJ IDEA.

I built a VS Code extension for Rexx using Langium, an open-source language engineering tool with support for the Language Server Protocol (LSP). Langium is a TypeScript-based framework designed for creating language servers and LSP allows language support to be implemented once and reused across multiple editors. 

Getting Started: Scaffolding the Langium Project 

Setting up the Langium project for Rexx was very straightforward. I followed Langium’s official documentation and ran the following commands in a new repository. 

 

These commands generated several important files, which will be useful later: 

  • Grammar definition template 
  • Language server setup 
  • Client-side VS Code extension 

 Crafting the Rexx Grammar 

The most challenging aspect of this project was writing the Langium grammar. Having never used Rexx prior, before writing the grammar, I spent some time familiarizing myself with the syntax and structure. I learned that Rexx has many unique characteristics which are different from the modern programming languages I have used in the past: 

  1. Statements can be ended with or without semicolons – the language doesn’t force you to use them 
  2. Descriptive labels can be added anywhere in the code (e.g. “Label:”) to mark code sections and jump to them later 
  3. Variables do not need to be declared before use 
  4. Rexx has “compound variables,” which are variables with fields (e.g. name.first and name.last) to support data structures such as lists, arrays, trees, etc. 
  5. Long statements can be continued onto the next line with a comma 

 

Here is a brief excerpt from the Langium grammar:  

Challenges When Writing the Grammar 

To develop an accurate grammar for Rexx, I had to extensively study the existing ANTLR4 grammar from the IntelliJ IDEA plugin and the IBM official Rexx language documentation to learn the nuances of the syntax and to translate them into Langium’s grammar format. 

For example, the following ANTLR4 instructions for a Rexx parse instruction: 

…look like this in Langium: 

 

Fortunately, prior to working on this project, I had completed a class called the “Organization of Programming Languages” at my university, which gave me a baseline understanding of how regular grammars and languages work.  Although the Langium grammar is still a work in progress and does not fully implement every feature from the official Rexx language, the current project supports most statements and syntaxes. 

Syntax Highlighting 

Langium provides a mechanism for syntax highlighting through semantic tokens. I created a custom semantic token provider that analyzes the Rexx abstract syntax tree (AST) and applies appropriate token types. 

Validation Rules 

Langium has a validation framework which traverses the AST to ensure the Rexx input files are correct. I created basic validations which check missing expressions in assignments and incomplete if statements.  

Putting it All Together 

A key part of integrating the Rexx language services was setting up the dependency injection module, which connects the custom validators and syntax highlighters to Langium’s language server framework. 

Finally, I ran “npm run langium:generate” followed by “npm run build” to convert the Langium grammar and validation logic into executable code. After launching the VS Code extension (by pressing the F5 key), we can view a sample Rexx file locally: 

  

If we try writing an IF statement without completing the THEN clause, this appears:  

Success! We have achieved basic syntax highlighting and validations for the Rexx language.   

Conclusion 

Developing the Rexx language server with Langium has been a very rewarding experience. The VS Code extension now provides basic support for essential features including syntax highlighting, error checking, and language validation – making it easier for developers to work with Rexx. 

What made this project especially fulfilling was the opportunity to build the tool from the ground up and apply theoretical knowledge from my coursework to a real-world application. Furthermore, this project strengthened my ability to navigate and understand technical documentation, a skill that will be invaluable when I enter the workforce as a software engineer.  

I’m especially grateful to my mentor, Uladzislau from IBA Poland, for his consistent guidance and support throughout the semester – despite the challenges of a 6-hour time difference! I’d also like to extend my thanks to Professor Madhavji for enabling Western University students to take part in this incredible learning opportunity. 

Relevant Links 

Open Mainframe Project is currently accepting applications for the 2025 Summer Mentorship. Applications are due by May 9. Learn more here or watch mentee presentations on the Mentorship playlist here

Keep up to date with Open Mainframe Project:

OSZAR »