Expand description
LLVM IR Code Generation via Text
Generates LLVM IR as text (.ll files) and invokes clang to produce executables. This approach is simpler and more portable than using FFI bindings (inkwell).
§Code Generation Strategy
Stack is threaded through all operations as a pointer:
- Start with null stack pointer
- Each operation takes stack, returns new stack
- Final stack is ignored (should be null for well-typed programs)
§Runtime Function Declarations
All runtime functions follow the pattern:
define ptr @name(ptr %stack) { ... }for stack operationsdefine ptr @push_int(ptr %stack, i64 %value) { ... }for literals- Stack type is represented as
ptr(opaque pointer in modern LLVM)