55beb23220
- Fixed module flattening in self-hosted compiler (Cli_Compile now unwraps module wrappers) - buxc2 check now finds functions in module-wrapped files (token.bux: funcCount=6, Main.bux: funcCount=2) - Added debug prints to trace lexer.bux timeout and check x segfault - Remaining issues: lexer.bux hangs in self-hosted pipeline, check x segfaults in runtime
26 lines
640 B
Plaintext
26 lines
640 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();
|
|
Print("Main count=");
|
|
PrintInt(count);
|
|
PrintLine("");
|
|
// 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);
|
|
}
|
|
}
|