How hlee131/pyjac works
Main Processing Pipeline (Central Flow)
• Source Code Input
• Lexical Analysis (Lexer)
• Parsing
• Type Checking
• Code Generation (LLVM IR)
• Final Executable Output
Component Details
a. Lexer Component (src/lexer.c):
• Input handling for characters
• Special indentation handling subsystem
• Error recovery mechanism (panic mode)
• Output: Token stream
b. Parser Component (src/parser.c):
• Two parsing strategies:
• LL(1) predictive parser for statements
• Pratt parser for expressions
• Output: Abstract Syntax Tree (AST)
c. Type Checker Component (part of semantic analysis):
• Multi-pass system:
• Pass 1: Global symbol collection
• Pass 2: Statement/Expression checking
• Symbol table integration
• Error handling with 'error' subtype
d. Code Generator Component (src/codegen.c):
• LLVM IR generation process
• Link to optimization pipeline
Supporting Systems
a. Symbol Table (src/symtab.c):
• Hash table structure
• Scope management
b. AST Management (src/ast.c):
• Tree structure
• Link to both parser and type checker
Specific Implementation Details
Important architectural features:
• Indentation stack for Python-like syntax
• Error recovery mechanisms
• Symbol table hierarchy
• Type system with error subtype
• LLVM IR integration point