Skip to content

Repository files navigation

bamTiScript

bamTiScript compiler pipeline from TypeScript source through an abstract syntax tree and bytecode to native output

License: MIT Rust Edition: 2024 MSRV: 1.97.1

bamTiScript is a pre-release Rust toolchain that type-checks, runs, and compiles TypeScript. TypeScript 7.0.2 compatibility is in progress.

Naming conventions

  • Repository: bamTiScript
  • CLI binary: bamts
  • Workspace crates: bamts, bamts-cli, bamts-compiler, bamts-cancel, bamts-bytecode, bamts-runtime, bamts-codegen, bamts-native, bamts-node, bamts-verification, and private bamts-napi
  • npm packages: bamti (in-process Node 24+ interface) and bamti-cli (standalone CLI transport). Currently published 0.1.0 packages on npm do not provide native binary artifacts; the source implementation of Node-API bindings is not yet published.

Quickstart

Build the CLI from source, create a TypeScript entrypoint, type-check it, and run it:

cargo build --release -p bamts-cli

cat > hello.ts <<'EOF'
const message: string = "hello from bamts";
process.stdout.write(`${message}\n`);
EOF

target/release/bamts check hello.ts
target/release/bamts run --target jit hello.ts
target/release/bamts compile --target aot -o hello hello.ts
./hello

Project status

  • Version 0.2.0 is pre-release.
  • bamti provides an in-process Node 24+ interface backed by native Node-API bindings (bamts-napi) and atomic cancellation (bamts-cancel), while bamti-cli is the standalone CLI transport.
  • The native addon design targets five host platform packages (@bamti/bamti-linux-x64-gnu, @bamti/bamti-linux-arm64-gnu, @bamti/bamti-darwin-x64, @bamti/bamti-darwin-arm64, @bamti/bamti-win32-x64-msvc) with fail-closed optional artifact loading.
  • Currently published 0.1.0 npm packages do not contain prebuilt native binary artifacts. Real five-target release validation remains blocked by GitHub billing and is unverified. Build the working CLI from source with Cargo on Linux x64.
  • The documented runtime target is Linux x64. AOT steps use the C compiler driver selected by $CC, defaulting to cc.

Current capabilities

  • Type checking with text, pretty, json, github, and compact diagnostic output
  • JIT execution with run --target jit
  • AOT execution and native binary compilation with --target aot
  • UTF-16 code-unit indexing for ECMAScript strings
  • In-process Node.js 24+ interface via native Node-API bindings (bamts-napi) with atomic cancellation control (bamts-cancel)
  • A limited Node-style host surface that includes process.stdout.write

Explicit limitations

  • TypeScript 7.0.2 is the compatibility oracle and target, not a completed compatibility claim.
  • compile accepts one entrypoint per invocation and only the AOT target. -o selects the output path. Declaration generation and source-map output are rejected.
  • bamti requires Node.js 24 or later. Currently published 0.1.0 npm packages do not contain compiled native artifacts; the source-tree native addon implementation is unpublished.
  • bamti optional native package loading is fail-closed. Real five-target runtime release verification is blocked by GitHub billing and has not passed.
  • The host runtime implements a limited Node-style API surface. It does not provide full Node.js compatibility.
  • AOT output targets the host architecture. Cross-compilation and non-Linux runtime behavior are not verified.
  • The root workspace policy defaults to unsafe_code = "forbid". Most crates inherit it. Native code generation, host export, verification, FFI, and private bamts-napi crates contain narrowly scoped, documented exceptions. This policy is not an end-to-end formal memory-safety guarantee.
  • The project publishes no performance benchmark or production-readiness claim.
  • Formal source artifacts target named properties. The current acceptance state is recorded in the proof ledger; complete compiler and runtime correctness is not proven.

Documentation

Contributing

See CONTRIBUTING.md for local environment setup (Rust 1.97.1, Edition 2024) and mandatory unpiped validation gates:

cargo fmt --all --check
cargo check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

Every commit must implement one logical concern and compile cleanly.

License

Distributed under the MIT License.

About

Pre-release clean-room TypeScript 7.0.2 compiler and JavaScript runtime in Rust, with type checking, a tsc-compatible CLI, JIT/AOT execution, and Lean 4 models.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages