Files
hakorune/local_tests/test_wasm_execution.sh
Moe Charm 3df87fb1ce fix(phase-4.3c-3): Fix StringBox literal handling in MIR builder
Phase 4-3c-3 Complete: WASM host functions now correctly output string content

## Changes:
- Fixed MIR builder to handle StringBox with string literal arguments
- Special case for  to generate proper string constants
- Removed debug output after successful verification
- WASM now correctly outputs "Hello MIR!" instead of "StringBox"

## Test Results:
- MIR generation:  Generates  correctly
- WASM compilation:  String data correctly placed at offset 4096
- WASM execution:  Outputs "Hello MIR\!" as expected

## Technical Details:
- Modified build_new_expression() to detect StringBox with literal arguments
- Generates Const instruction with actual string content
- Host function reads StringBox memory layout correctly

This completes the WASM string output functionality for Phase 4.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 13:49:35 +09:00

24 lines
752 B
Bash

#!/bin/bash
# WASM execution test script
echo "🎯 Testing WASM compilation and execution with host functions"
# First compile to WAT
echo "📝 Compiling test_mir_simple.nyash to WASM..."
../target/release/nyash --compile-wasm test_mir_simple.nyash
# Check if WAT was generated
if [ -f "test_mir_simple.wat" ]; then
echo "✅ WAT file generated successfully"
echo "📄 WAT content preview:"
head -20 test_mir_simple.wat
echo "..."
# Now we need a custom WASM runner that provides host functions
echo ""
echo "🚀 To execute WASM with host functions, we need to build a custom runner"
echo " that provides the required imports (env::print, etc.)"
else
echo "❌ WAT file generation failed"
exit 1
fi