How tau-lang/tau works
Tau is a modular compiler. Its main workflow accepts a source file and CLI options, processes the source through lexing, parsing, declaration collection and semantic analysis, then generates C, QBE or LLVM output. The graph preserves the documented compiler stages and the distinct backend implementations. Evidence is limited to the README, source excerpts and SOURCE INDEX references; unsampled module internals are not assumed to call one another.
Main entry points: lib.rs Compile dispatch · analyzer.rs Semantic analysis · expression.rs LLVM backend · declaration.rs Typed AST
Components 19
Command line
- CLI options
compiler-cli/src/options.rs - Compile dispatch
compiler-cli/src/lib.rs
Compiler core
- Lexer
compiler-core/src/lexer.rs - Parser
compiler-core/src/parser.rs - Header pass
compiler-core/src/header.rs - Semantic analysis
compiler-core/src/analyzer.rs - Type inference
compiler-core/src/type_/expression.rs - Type system
compiler-core/src/type_.rs - Typed AST
compiler-core/src/ast/declaration.rs - IR translator
compiler-core/src/translator.rs - IR emitter API
compiler-core/src/ir/emitter.rs
C backend
- C code generator
generator-c/src/code.rs - C header generator
generator-c/src/header.rs - C source formatting
generator-c/src/source_code.rs
Other backends
- LLVM backend
generator-llvm/src/expression.rs - LLVM declarations
generator-llvm/src/declaration.rs - LLVM statements
generator-llvm/src/statement.rs - QBE backend
generator-qbe/src/emitter.rs
Other components
- Compiler user
Connections 20
- Compiler user → CLI options: sets options
compiler-cli/src/options.rs - CLI options → Compile dispatch: configures
compiler-cli/src/lib.rs - Compile dispatch → Lexer: processes source
- Lexer → Parser: supplies tokens
compiler-core/src/lib.rs - Parser → Header pass: passes AST
compiler-core/src/lib.rs - Header pass → Semantic analysis: precedes analysis
compiler-core/src/lib.rs - Semantic analysis → Type inference: checks types
- Type inference → Type system: uses types
compiler-core/src/type_/expression.rs - Semantic analysis → Typed AST: produces typed AST
- Compile dispatch → Typed AST: receives result
compiler-cli/src/lib.rs - Typed AST → IR translator: translated by
- IR translator → IR emitter API: calls emitter
- Compile dispatch → C code generator: transpiles AST
compiler-cli/src/lib.rs - Compile dispatch → C header generator: transpiles AST
compiler-cli/src/lib.rs - C code generator → C source formatting: formats output
generator-c/src/code.rs - C header generator → C source formatting: uses formatting
generator-c/src/header.rs - Compile dispatch → LLVM backend: folds AST
compiler-cli/src/lib.rs - Compile dispatch → QBE backend: translates AST
compiler-cli/src/lib.rs - LLVM backend → LLVM declarations: delegates declarations
- LLVM backend → LLVM statements: delegates statements