BankLang

BankTS Language Reference

BankTS is a small banking language that compiles to COBOL. Its types are TypeScript's — decimal<18, 2>, string<16>, record, aliases — and its statements are its own: transaction, file … sequential input, cursor, queue, on error. The goal is safety, auditability, and predictable COBOL generation, not TypeScript compatibility; a BankTS module is not a TypeScript module and tsc cannot read one.

This page is the contents. Every rule lives on one of the pages below.

Until 2026-08-06 all of it was one 108 KB file whose sections were numbered in a single sequence — a sequence that had gone wrong, with two sections numbered 14, two numbered 15, and 3a before 3c before 3b. The numbers are gone with the file they belonged to. Each page is a topic, and each diagnostic cites the page.


The whole language, formally

Page What is in it
Grammar Every production in EBNF, and every word the language reserves
Stability What is settled, what is not, and what a change to the language costs

The program

Page What is in it
Programs and modules What a module is, how names are chosen, what BankTS will not let you write, and what the backend needs before it can build

The data

Page What is in it
Types Primitives and how each is stored, dates and times, edited fields, currency, nullability
Records Layout, inheritance, generics, variant records, bounded arrays, imported copybooks

The code

Page What is in it
Functions and calls Functions, strings, calls between routines and to another program
Control flow and operators Branching and loops, and every operator with the COBOL it becomes
Transactions Entry points, ledger postings, failures, audit events

The environment

Page What is in it
Files Declarations, organisation, keys, file status
Batch operations The PARM, sorting, procedures on the way through, restart
Reports Report Writer: control breaks, totals, pagination
Db2 and embedded SQL Statements, host variables, SQLCODE, cursors, units of work
CICS Online transactions, the communication area, response handling
IMS DL/I Databases, segments, the PCB list
IBM MQ Queues, messages, syncpoint

Where these rules are enforced

Every rule on these pages that can be broken has a diagnostic, and every diagnostic names the page it came from. bankc explain BANK-LED-001 prints any of them with an explanation and a remediation.

Trying it

examples/ carries twenty-three worked programs, each with its generated COBOL, copybooks, JCL and verification report. The playground runs the whole compiler in a browser.


Read this page as Markdown on GitHub →