Maintainer Handbook for Compiler Engineering, Security Audits & Ecosystem Architecture
Edition: TechScript 2.0 LTS | Primary Implementation: Rust
The TechScript compiler transforms source code (.txs) into executed programs, static web assets, or native application binaries through a modular multi-stage pipeline:
[Source Code .txs]
│
▼
[Lexer] ──────────► Token Stream (techscript_lexer)
│
▼
[Parser] ─────────► Abstract Syntax Tree (techscript_ast / parser)
│
▼
[Semantic Analysis] ─► Symbol Resolution & Type Checking (techscript_semantic)
│
▼
[IR Lowering] ────► Flat SSA Intermediate Representation (techscript_ir)
│
▼
[Optimizer] ───────► Dead-code Elimination, Constant Folding (techscript_optimizer)
│
┌─────┴─────────────────────────┬─────────────────────────┐
│ │ │
▼ ▼ ▼
[Bytecode Lowering] [LLVM Native Codegen] [Webforge / Appforge]
(techscript_bytecode) (techscript_llvm_backend) (stdlib::web / CLI app)
│ │ │
▼ ▼ ▼
[Stack-based VM] [Native Object] [dist/ & APK/AAB/EXE]
(techscript_vm) (Linker Executable) (Gradle & Platform Bundles)
The TechScript workspace contains 21 focused crates:
| Crate | Directory | Purpose |
|---|---|---|
techscript_common |
compiler/common |
Source roles, file validation, span descriptors |
techscript_syntax |
compiler/syntax |
Token definitions, keyword sets, precedence |
techscript_errors |
compiler/errors |
Diagnostic codes, error reporting, source snippets |
techscript_ast |
compiler/ast |
Abstract Syntax Tree node definitions |
techscript_lexer |
compiler/lexer |
Lexical scanner and tokenization engine |
techscript_parser |
compiler/parser |
Recursive-descent grammar parser with DSL engine |
techscript_semantic |
compiler/semantic |
Symbol table, scope analysis, type validation |
techscript_ir |
compiler/ir |
Flat Static Single Assignment (SSA) IR |
techscript_optimizer |
compiler/optimizer |
Optimization passes (folding, dead code) |
techscript_bytecode |
compiler/bytecode |
Bytecode instruction set and lowering |
techscript_llvm_backend |
compiler/llvm_backend |
LLVM IR generation and JIT/AOT hooks |
techscript_vm |
runtime/vm |
Stack-based Virtual Machine execution engine |
techscript_interpreter |
runtime/interpreter |
Direct AST evaluation runtime |
techscript_builtins |
runtime/builtins |
Core intrinsic functions |
techscript_runtime |
runtime/runtime |
Memory model, callable traits, values |
techscript_stdlib |
stdlib |
Standard library modules (math, web, json, etc.) |
techscript_module_resolver |
compiler/module_resolver |
Import resolution and path security |
techscript_package_manager |
tools/package-manager |
Dependency resolution, semver, lockfiles |
techscript_formatter |
tools/formatter |
Code formatting engine (tsc fmt) |
techscript_linter |
tools/linter |
Static analysis and deprecation warnings |
techscript_cli |
cli |
Unified tsc CLI command runner |
- The module resolver (
techscript_module_resolver) strictly forbids..path components and directory traversal. - The package manager (
techscript_package_manager&tsc install) validates that dependency names and extract destinations contain no path traversal characters (..,/,\).
TechScript packages declare required capabilities (FileSystem, Network, Process) in techscript.toml. The package manager enforces:
- Dependencies cannot elevate permissions beyond what the parent project is granted.
- Network requests are validated against project-declared host whitelists.
The unified CLI passes arguments directly as discrete strings (std::process::Command::new().args([...])) rather than concatenating shell strings, completely preventing command-injection attacks via filenames or arguments.
Scaffolded Appforge Android hosts strictly configure:
allowFileAccess = falseandallowContentAccess = falseon WebViews.- Local streaming via Google's
WebViewAssetLoaderwith encryptedhttps://appassets.androidplatform.net/assets/domain mapping. - Minimal permissions: only
android.permission.INTERNETby default. - No hardcoded private keys, keystore passwords, or credentials in templates.
# Verify workspace compilation across all 21 crates
cargo check --workspace
# Run complete automated test suite
cargo test -p techscript_cli
cargo test --workspace
# Run official language test battery
python verify_all_examples.pycargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings- Define the command argument enum in
cli/src/lib.rs. - Implement execution logic in
cli/src/commands/<command>.rs. - Dispatch the command in
cli/src/entrypoint.rs. - Add CLI snapshot and functional tests in
cli/tests/.
- Create
stdlib/src/<module>.rs. - Implement functions adhering to the
StdFnCallbacksignature. - Register the module in
stdlib/src/lib.rsunderStdlibRegistry::register_all(). - Expose documentation in
docs/TECHSCRIPT_LANGUAGE_REFERENCE.md.