How tinygo-org/tinygo works
Main Components of the System
a. Core Compiler Components:
• Compiler Frontend (compiler/)
• LLVM Backend Integration (compiler/llvm.go)
• Builder System (builder/)
• Transformation Pipeline (transform/)
• Loader (loader/)
b. Runtime Components:
• Runtime System (src/runtime/)
• Garbage Collectors (runtime/gc_*.go)
• Scheduler Implementations (runtime/scheduler_*.go)
c. Target Support:
• Microcontroller Targets (targets/*.json)
• WebAssembly Targets (targets/wasm*.json)
• Operating System Targets
d. Standard Library Implementation:
• Machine Package (src/machine/)
• Runtime Package (src/runtime/)
• Other Standard Packages (src/*)
┌─────────────────────────────────────────────────────────┐
• TinyGo Compiler Frontend │
• ┬─────────────────────┬────────────────┤
• Go Parser │ Type Checker │ IR Generator │
• ┬────────┴──────────┬──────────┴───────┬────────┘
┌────────▼────────┐ ┌───────▼───────┐ ┌──────▼────────┐
• Transformation │ │ Optimization │ │ LLVM Backend │
• Pipeline │──▶│ Passes │──▶│ Integration │
• ┬────────┘ └───────────────┘ └──────┬────────┘
┌────────▼──────────────────────────────┐ │
• Target Backends │ │
• ┬─────────────┬──────────┤ │
• Embedded │ WASM │ OS │ │
• (MCU) │ (Browser/ │ (Linux/ │ │
• Server) │ macOS) │ │
• ┴─────────────┴──────────┘ │
• ▲ │
• ▼
┌────────┴─────────────────────────────────────────────┐
• Runtime System │
• ┬────────────────┬────────────────────┤
• GC Systems │ Schedulers │ Platform Support │
• ┴────────────────┴────────────────────┘
Key Elements to Highlight
a. Compilation Pipeline:
• Flow from Go source code through various compilation stages
• Transformation passes
• Integration with LLVM backend
b. Target Support:
• Different target platforms
• Shared components vs. platform-specific components
• Build configuration flow
c. Runtime Features:
• Different garbage collector implementations
• Scheduler variants (cooperative, none, tasks)
• Platform-specific runtime support
Additional Details
Callouts for:
• Configuration system (compileopts/)
• Build system integration (builder/)
• Testing infrastructure (tests/)
• Standard library implementation details