Skip to content

@Interpreter

Marker-only — documents an interpreter for a small language or DSL. Grammar and evaluation remain hand-written.

KindMarker-only class
Backendslegacy, stage3
Requires generateNo

Example

ts
import { Interpreter } from 'lombok-typescript/legacy';

type Expr = { type: 'num'; value: number } | { type: 'add'; left: Expr; right: Expr };

@Interpreter
class CalcInterpreter {
  eval(node: Expr): number {
    if (node.type === 'num') return node.value;
    return this.eval(node.left) + this.eval(node.right);
  }
}

Use this decorator to signal intent in docs and metadata, not to parse expressions automatically.

Released under the MIT License.