How macdee661/mzharima-compiler works
BMinor is a compiler for the BMinor language. Its principal workflow takes source through scanning and parsing into an AST, then resolves names, checks types, and generates assembly; the README also documents token encoding, AST printing, and a standard library for print and exponentiation. The graph preserves those product capabilities and the symbol/scope layer. Relationships follow the README and the central driver’s indexed references; some implementation details were not excerpted, so uncertain internal links are omitted.
Main entry points: decl.c AST model · scope.c Scope manager · scanner.c Scanner · codegen.c Assembly generator
Components 18
Front end
- Scanner
scan/scanner.c - Token encoder
encode/encoder.c - Parser
parse/parser.c - AST model
decl.c - AST printer
print/printer_driver.c
Semantic analysis
- Name resolver
decl.c - Type checker
decl.c - Scope manager
scope.c - Symbols
symbol.c - Name table
hash_table.c - Type model
type.c
Code generation
- Assembly generator
codegen/codegen.c - Assembly output
- Standard library
library.c
Language support
- Token definitions
scan/tokens.h - Statement model
stmt.c - Parameter model
param_list.c
Other components
- Compiler user
Connections 17
- Compiler user → Scanner: supplies source
- Scanner → Token definitions: emits tokens
scan/scanner.c - Scanner → Token encoder: encodes tokens
- Parser → AST model: builds AST
- AST model → AST printer: prints AST
print/printer_driver.c - AST model → Name resolver: resolves names
decl.c - Name resolver → Scope manager: looks up names
decl.c - Scope manager → Name table: stores bindings
scope.c - Scope manager → Symbols: binds symbols
scope.c - AST model → Type checker: checks types
decl.c - Type checker → Type model: compares types
decl.c - Type checker → Scope manager: binds parameters
decl.c - AST model → Assembly generator: generates assembly
- Assembly generator → Assembly output: writes assembly
codegen/codegen.c - Assembly generator → Standard library: calls runtime functions
codegen/codegen.c - AST model → Statement model: contains statements
- AST model → Parameter model: uses parameters