9c6b516453
- Reorganize repository to Rust-style layout: compiler/bootstrap/ compiler/selfhost/ compiler/tests/ library/std/ library/runtime/ tests/ tools/ - Add buxs/ Windows-compatible project root - Add borrow checker tests and implement: - Alias analysis (double mutable borrow detection) - Use-after-move detection for own T - Expand standard library: - Std::Os: Args, Env, Cwd, Chdir - Std::Time: NowMs, NowUs, SleepMs - Std::Process: Run, Output - Std::Io: PrintInt64 (fixes 32-bit truncation bug) - Add examples: os_time.bux, process.bux - Fix PrintInt to use int64_t in C runtime
24 lines
618 B
Plaintext
24 lines
618 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;
|
|
extern func bux_alloc(size: uint) -> *void;
|
|
|
|
// 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);
|
|
}
|
|
}
|