e8084b2840
Runtime: - bux_argc()/bux_argv() — command-line arg access from Bux programs - g_argc/g_argv globals — set by C main() wrapper Compiler: - C backend generates extern g_argc/g_argv + int main(argc,argv) wrapper - main.bux reads args via bux_argc/bux_argv and passes to Cli_Run buxc2 verified: - buxc2 version — reads CLI args correctly - buxc2 check <file.bux> — lexes, parses, type-checks, generates C - buxc2 build <file.bux> <output.c> — writes C output PLAN.md updated with Phase 7.10 status and remaining work. All 18 examples pass, all unit tests pass.
23 lines
574 B
Plaintext
23 lines
574 B
Plaintext
// main.bux — Entry point for the Bux self-hosting compiler
|
|
module Main {
|
|
|
|
// C runtime for command-line args
|
|
extern func bux_argc() -> int;
|
|
extern func bux_argv(index: int) -> String;
|
|
|
|
// Forward declaration from Cli module
|
|
func Cli_Run(args: *String, argCount: int) -> int;
|
|
|
|
func Main() -> int {
|
|
let count: int = bux_argc();
|
|
// Allocate array of String pointers
|
|
let args: *String = bux_alloc(count as uint * 8) as *String;
|
|
var i: int = 0;
|
|
while i < count {
|
|
args[i] = bux_argv(i);
|
|
i = i + 1;
|
|
}
|
|
return Cli_Run(args, count);
|
|
}
|
|
}
|