The bamTiScript compiler emits diagnostics during lexical analysis, parsing, semantic analysis, type checking, and resource checking.
Diagnostic codes use the form BAMTS-<FAMILY><NUMBER>:
| Family | Name | Scope and description |
|---|---|---|
BAMTS-L |
Lexer | Scans source text into tokens and reports malformed lexical input. |
BAMTS-P |
Parser | Builds the abstract syntax tree and reports grammar errors. |
BAMTS-C |
Checker | Binds symbols, evaluates types, and reports semantic errors. |
BAMTS-W |
Warning | Reports configurable lint rules. |
BAMTS-R |
Resource | Enforces source-input budgets. |
For the lint rules in the BAMTS-W family, see crates/bamts-compiler/RULES.md.
The public CLI follows the TypeScript 7.0.2 diagnostic presentation model:
bamts --noEmit --pretty false example.ts
bamts --noEmit --pretty example.ts--pretty false produces stable one-line TypeScript diagnostics. --pretty enables color and context intended for an interactive terminal. The legacy --diagnostics-format, --format, and --error-limit options are not part of the current public CLI.
Diagnostic line and column coordinates are 1-based. Columns and source offsets count UTF-16 code units.
- Line numbers start at line 1.
- Diagnostic line and column coordinates are 1-based.
- Source offsets count UTF-16 code units.
For the string representation and coordinate mapping, see docs/solutions/architecture-patterns/exact-ecmascript-utf16-strings.md.
verification/diagnostic-code-map.json records a mapping only when the repository has TypeScript evidence for an equivalent rule. Unmapped bamTiScript diagnostics remain explicit. Each mapping record contains the bamTiScript code, TypeScript code, test snippet, and observed tsc output.
Given example.ts:
const value: number = "not a number";Run:
bamts --noEmit --pretty false example.tsThe CLI reports a TypeScript-style diagnostic with the source location, category, code, and message.