Files
five/examples/test_frb_mem.prg
Charles KWON OhJun 59568f3301 Five v0.9 — Harbour + Go fusion language
- Compiler: PP → Lexer → Parser → Analyzer → Gengo pipeline
- Parser: 232/236 (98%) Harbour compatibility, registry-based dispatch
- RTL: 351 Harbour-compatible functions
- RDD: DBF/NTX/CDX engines with Rushmore bitmap optimization
- Go Interop: IMPORT + pkg.Func() + obj:Method() with FastPath (15M calls/sec)
- HB_FUNC API: Full Harbour C API compatible Go bridge
- Concurrency: SPAWN/LAUNCH/GOROUTINE, <-, WATCH, PARALLEL FOR, ASYNC/AWAIT
- Extensions: Multi-return, DEFER, Slice, f-string, Nil-safe ?:, CONST
- Macro Compiler: Runtime AST parsing and evaluation
- Debugger: TUI debugger with source display, breakpoints, stepping
- FRB: Native + Pcode dual mode runtime binary
- Tests: 13 packages ALL PASS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 09:41:50 +09:00

43 lines
1.0 KiB
Plaintext

// FRB in-memory compilation test
// Compiles PRG source at runtime and executes it
FUNCTION Main()
LOCAL pMod, cSource
? "=== FRB In-Memory Compilation Test ==="
? ""
// 1. Compile PRG source string at runtime
cSource := 'FUNCTION Double(n)' + Chr(10) + ;
' RETURN n * 2' + Chr(10) + ;
'FUNCTION Greet(cName)' + Chr(10) + ;
' RETURN "Hi " + cName + "!"' + Chr(10)
? "Compiling PRG source at runtime..."
pMod := FrbCompile(cSource)
IF pMod = NIL
? "ERROR: Compile failed"
RETURN NIL
ENDIF
? "Compiled!"
? ""
// 2. Call dynamically compiled functions
? "Double(21):", FrbDo(pMod, "DOUBLE", 21)
? "Greet('Charles'):", FrbDo(pMod, "GREET", "Charles")
? ""
FrbUnload(pMod)
// 3. One-shot: compile + run + unload
? "FrbExec one-shot:"
cSource := 'FUNCTION Main()' + Chr(10) + ;
' ? " Hello from dynamic PRG!"' + Chr(10) + ;
' RETURN 42' + Chr(10)
? "Result:", FrbExec(cSource)
? ""
? "=== Done ==="
RETURN NIL