How pauljoohyunkim/pp works
PP is a C-implemented programming-language compiler with an LLVM backend. A user invokes the pplang command on .pp files; the compiler processes source through lexing, parsing, semantic analysis, and LLVM code generation, then emits the requested output. The README also documents optimization, LLVM IR and assembly output, .ppi declarations, and multi-source linking. The main source index identifies the pipeline’s stage modules, but unsampled CLI and pipeline internals limit confidence about some detailed call relationships.
Main entry points: pp_compiler_pipeline.c Compile Pipeline · pp_lexer.c Lexer · pp_semantic_analyzer.c Semantic Analyzer · pp_parser.c Parser
Components 18
Frontend
- Lexer
src/pp_lexer.c - Parser
src/pp_parser.c - AST
src/pp_ast.c - Token Definitions
src/pp_tokens.c
Semantic Model
- Semantic Analyzer
src/pp_semantic_analyzer.c - Symbol Tables
src/pp_symbol_table.c - Type System
src/pp_type.c - Global Type Table
src/pp_type_table.c
LLVM Backend
- LLVM Code Generator
src/pp_code_generator.c - LLVM Optimization
src/pp_code_optimization.c
Compiler Runtime
- pplang CLI
src/pplang.c - Compile Pipeline
src/pp_compiler_pipeline.c - Linker Offload
src/pp_linker_offload.c - String Pool
src/pp_string_pool.c - Error Handling
src/pp_error.c
Other components
- Compiler User
- LLVM
- Compiled Output
Connections 19
- Compiler User → pplang CLI: invokes
README.md - pplang CLI → Compile Pipeline: starts compile
src/pplang.c - Compile Pipeline → Lexer: lexes source
README.md - Compile Pipeline → Parser: parses tokens
README.md - Compile Pipeline → Semantic Analyzer: checks semantics
README.md - Compile Pipeline → LLVM Code Generator: generates LLVM
README.md - Compile Pipeline → LLVM Optimization: optimizes output
src/pp_compiler_pipeline.c - Lexer → Token Definitions: creates tokens
src/pp_lexer.c - Parser → AST: builds AST
src/pp_parser.c - Semantic Analyzer → Symbol Tables: populates symbols
- Semantic Analyzer → Global Type Table: populates types
- Semantic Analyzer → Type System: checks types
- LLVM Code Generator → LLVM: emits LLVM IR
- LLVM Optimization → LLVM: optimizes IR
- Compile Pipeline → Compiled Output: emits artifact
- pplang CLI → Linker Offload: links sources
README.md - Lexer → String Pool: interns lexemes
src/pp_lexer.c - Lexer → Error Handling: reports errors
src/pp_lexer.c - Parser → Error Handling: reports errors