How divyanshu0902/scriptc works
scriptc is a TypeScript/JavaScript compiler that turns checked programs and their imported packages into native executables or WebAssembly, with a native runtime for supported Node APIs. The principal workflow is: invoke the CLI, load and resolve the TypeScript program, lower it into the compiler IR, generate target code, then link a standalone result. Coverage reporting, diagnostics, FFI, and runtime integrations are meaningful product branches. Some links are documented only at product level or represented by unsampled directories, so those edges are dashed rather than asserted as inspected calls.
Main entry points: pipeline.ts Frontend Pipeline · lowerer.ts Frontend Lowering · native-codegen.ts Backend Orchestration · src Native Runtime
Components 20
CLI and Frontend
- CLI Commands
packages/cli/src/main.ts - Frontend Pipeline
packages/compiler/src/frontend/pipeline.ts - TypeScript Services
packages/compiler/src/frontend/ts7/adapter.ts - Program Resolution
packages/compiler/src/frontend/resolve.ts
Lowering and IR
- Frontend Lowering
packages/compiler/src/frontend/lowering/lowerer.ts - Array Pipelines
packages/compiler/src/frontend/lowering/containers/array-pipelines.ts - Collection Ingestion
packages/compiler/src/frontend/lowering/collection-ingestion.ts - Compiler IR
packages/compiler/src/ir/ir.ts
Code Generation
- LLVM Optimizations
packages/compiler/src/backend/llvm - Backend Orchestration
packages/compiler/src/backend/native-codegen.ts - LLVM Code Generator
native/llvm-codegen/src/main.cpp - Native Linking
packages/compiler/src/backend/linker.ts
Runtime and Integrations
- Native Runtime
packages/runtime/src - Node API Bridge
packages/libnode-common/bridge/scr_node_bridge.cc - Worker Runtime
packages/runtime/src/scr_worker.c
Product Capabilities
- Diagnostics
packages/compiler/src/diagnostics/diagnostic.ts - Coverage Reports
packages/compiler/src/coverage/report.ts - WebAssembly Support
packages/compiler/src/backend/llvm/wasm-modules.ts - Native FFI
packages/compiler/src/ffi/ffi-manifest.ts
Other components
- Developer
Connections 20
- Developer → CLI Commands: runs commands
README.md - CLI Commands → Frontend Pipeline: invokes compiler
packages/cli/src/main.ts - Frontend Pipeline → TypeScript Services: loads program services
packages/compiler/src/frontend/pipeline.ts - Frontend Pipeline → Program Resolution: resolves imports
packages/compiler/src/frontend/pipeline.ts - Frontend Pipeline → Diagnostics: reports issues
packages/compiler/src/frontend/pipeline.ts - Frontend Pipeline → Frontend Lowering: lowers program
packages/compiler/src/frontend/pipeline.ts - Frontend Lowering → Array Pipelines: uses transforms
packages/compiler/src/frontend/lowering/containers/array-pipelines.ts - Frontend Lowering → Collection Ingestion: ingests collections
packages/compiler/src/frontend/lowering/collection-ingestion.ts - Frontend Lowering → Compiler IR: builds IR
packages/compiler/src/frontend/lowering/array-values.ts - Compiler IR → LLVM Optimizations: feeds backend
packages/compiler/src/backend/llvm/local-union-storage.ts - LLVM Optimizations → Backend Orchestration: provides LLVM emission
- Backend Orchestration → LLVM Code Generator: requests code generation
- Backend Orchestration → Native Linking: prepares native link
- Native Linking → Native Runtime: includes runtime
- Native Runtime → Node API Bridge: bridges Node APIs
README.md - Native Runtime → Worker Runtime: runs worker threads
packages/runtime/src/scr_worker.c - Developer → Coverage Reports: checks compatibility
README.md - Frontend Pipeline → Coverage Reports: analyzes program
- Backend Orchestration → WebAssembly Support: emits WebAssembly
- Frontend Pipeline → Native FFI: supports native FFI