Files
hakorune/src/llvm_py/test_boxcall.json
Selfhosting Dev ef44801fa6 Python LLVM backend implementation (experimental)
- Created llvmlite-based LLVM backend in src/llvm_py/
- Implemented all MIR14 instructions (const, binop, jump, branch, ret, compare, phi, call, boxcall, externcall, typeop, newbox, safepoint, barrier)
- Experimental LoopForm support
- ~2000 lines of clean Python code vs complex Rust/inkwell
- Useful for PHI/SSA validation and rapid prototyping
- Added documentation to CLAUDE.md

This was created while waiting for ChatGPT's investigation of BuilderCursor issues.
2025-09-12 20:55:13 +09:00

61 lines
1.2 KiB
JSON

{
"functions": [
{
"name": "ny_main",
"params": [],
"blocks": [
{
"id": 0,
"instructions": [
{
"op": "newbox",
"type": "StringBox",
"args": [],
"dst": 1
},
{
"op": "const",
"dst": 2,
"value": {
"type": "string",
"value": "Hello Nyash!"
}
},
{
"op": "boxcall",
"box": 1,
"method": "set",
"args": [2],
"dst": 3
},
{
"op": "boxcall",
"box": 1,
"method": "get",
"args": [],
"dst": 4
},
{
"op": "externcall",
"func": "print",
"args": [4],
"dst": null
},
{
"op": "const",
"dst": 5,
"value": {
"type": "i64",
"value": 0
}
},
{
"op": "ret",
"value": 5
}
]
}
]
}
]
}