How nim-lang/nimony works
Main Components Identification
a) Core Compiler Components (src/nimony/):
• Semantic Analysis (sem*.nim files)
• Type System (typeprops.nim, builtintypes.nim)
• Symbol Management (symtabs.nim)
• Expression Evaluation (expreval.nim)
• Dependencies Handler (deps.nim)
b) Supporting Tools:
• NIFC (Native Interface Compiler) (src/nifc/)
• Gear2/3 (Code Generation Tools) (src/gear2/, src/gear3/)
• NIFLER (Configuration Tool) (src/nifler/)
• XELIM (Transformation Tool) (src/xelim/)
Top Level:
[Source Code] -> [Nimony Compiler] -> [Compiled Output]
Detailed Level:
[Source Code] -> [Parser] -> [Semantic Analyzer] -> [Type Checker] ->
[Code Generator] -> [Native Code]
Component Relationships
a) Frontend Pipeline:
• How source code flows through semantic analysis (sem.nim)
• Type checking process (typeprops.nim, builtintypes.nim)
• Symbol table interactions (symtabs.nim)
b) Backend Pipeline:
• Code generation flow through NIFC
• How Gear2/3 interfaces with the compilation process
• AMD64 code generation path (src/nifc/amd64/)
Detailed Components
Frontend:
[Source Files] -> [Parser]
• ↓
[Symbol Tables] <- [Semantic Analyzer]
• ↓
[Type Checker] <- [Generic Instantiation]
Backend:
[NIFC] -> [Intermediate Representation]
• ↓
[AMD64 Generator] -> [Native Code]
Additional Elements
Subsystems for:
• Library management (src/lib/)
• Test infrastructure (tests/)
• Build configuration (config.nims)
This architecture should reflect the project's focus on creating a minimal but feature-rich Nim dialect with emphasis on incremental compilation and flexible module dependencies.