rts is a restricted subset of TypeScript, where the type of every identifier and expression must be determined at compile time and cannot be changed during the runtime. By restricted, we mean, dynamic typing or any mechanism that allows the change of type at runtime are not allowed in this subset.
The workflow of rts is the same as TypeScript:
Scanner -> Parser -> Binder -> Checker -> Emitter
The scanner and parser stage uses TypeScript's existing implementation, whereas a custom binder and emitter are used for rts.
Please note that while rts adheres to the TypeScript’s typing rules, there may be certain features or concepts from TypeScript that are not included in this subset due to its restrictiveness, which aims at reducing complexity and ensuring stronger statically typed codes.
The first milestone focused on implementing the core language features of rts, including:
- Block statement
- Variable declarations with
let - Empty statement
- Expression statement
- Control flow:
if/else,while,for,continue,break returnstatement- Function definition
- Primary expressions (identifiers, literals, grouping)
- Left-hand-side expressions (function calls, argument lists, function expressions)
- Postfix and prefix expressions (increment/decrement)
- Unary operators (
+,-,~,!) - Binary operators (arithmetic, comparison, equality, bitwise, logical)
- Conditional (ternary) operator
- Compound assignment operators
- Basic types (number, boolean, string)
- Function types
- Null type
The second milestone expanded the syntax surface with more advanced JavaScript language features:
- Enhanced control flow:
do-while,switch,try-catch - Extended loop constructs:
for-of,for-in throwstatement for exception handling
- Object system:
thiskeyword, property accessors - Object and array literals/initializers
- Operators:
typeof,delete,void,instanceof,in,new - Regular expression literals
- Comma operator
Status: functional — switch, throw, do-while, void, comma. Partial —
try (no accessible catch binding / finally), for-of, array/object literals,
property access (int-only, not first-class). Stubbed / not yet functional —
typeof, in, delete, instanceof, new, regexp literals, this, for-in.
See docs/NOT_COVERED.md for details.
The next milestone turns inward to make the existing surface sound: enforce the static-typing guarantee (a diagnostics gate), give values a real runtime representation (type lowering + first-class objects/arrays), then build float, hardened closures, and classes on that foundation. See docs/roadmad/0.0.3.md.
For a detailed list of implemented features, see docs/roadmad/0.0.1.md and docs/roadmad/0.0.2.md.