This document describes the compilation pipeline of the TechScript 2.0 compiler.
graph TD
A[Source File] --> B[Lexer]
B --> C[Parser]
C --> D[Abstract Syntax Tree]
D --> E[Semantic Analysis]
E --> F[IR Generation]
F --> G[Code Generator]
compiler/lexer)Scans the source character stream and generates tokens using the logos Rust library. Whitespace is ignored except when separating keywords or within string literals.
compiler/parser)Implements a top-down operator precedence (Pratt Parser) for parsing expressions cleanly. This avoids deeply nested recursive grammar structures and cleanly parses operator precedence.
compiler/ast)The parsing phase outputs an AST containing nodes representing program statements, expressions, loops, and definitions. Every node holds source code locations (Span) for error attribution.
compiler/semantic)Validates program semantics prior to runtime:
compiler/ir, compiler/bytecode, compiler/llvm_backend)Translates optimized AST structures into: