diff --git a/MIGRATION_v0.3.0.sh b/MIGRATION_v0.3.0.sh new file mode 100644 index 0000000..fd764f8 --- /dev/null +++ b/MIGRATION_v0.3.0.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Bux v0.3.0 — Restructure directories +set -e + +echo "=== Bux v0.3.0 Restructuring ===" + +# Step 1: Move compiler/selfhost → src +echo "Moving compiler/selfhost → src/" +git mv compiler/selfhost src + +# Step 2: Move compiler/bootstrap → bootstrap +echo "Moving compiler/bootstrap → bootstrap/" +git mv compiler/bootstrap bootstrap + +# Step 3: Move library/std → lib +echo "Moving library/std → lib/" +git mv library/std lib + +# Step 4: Move library/runtime → rt +echo "Moving library/runtime → rt/" +git mv library/runtime rt + +# Step 5: Move compiler/tests/*.nim → tests/ +echo "Moving compiler/tests/*.nim → tests/" +for f in compiler/tests/*.nim; do + git mv "$f" tests/ +done + +# Step 6: Remove empty/obsolete directories +echo "Removing _selfhost/" +rm -rf _selfhost + +echo "Removing empty compiler/ and library/" +rmdir compiler/tests 2>/dev/null || true +rmdir compiler 2>/dev/null || true +rmdir library 2>/dev/null || true + +echo "=== Done ===" diff --git a/compiler/bootstrap/ast.nim b/bootstrap/ast.nim similarity index 100% rename from compiler/bootstrap/ast.nim rename to bootstrap/ast.nim diff --git a/compiler/bootstrap/c_backend.nim b/bootstrap/c_backend.nim similarity index 100% rename from compiler/bootstrap/c_backend.nim rename to bootstrap/c_backend.nim diff --git a/compiler/bootstrap/cli.nim b/bootstrap/cli.nim similarity index 100% rename from compiler/bootstrap/cli.nim rename to bootstrap/cli.nim diff --git a/compiler/bootstrap/hir.nim b/bootstrap/hir.nim similarity index 100% rename from compiler/bootstrap/hir.nim rename to bootstrap/hir.nim diff --git a/compiler/bootstrap/hir_lower.nim b/bootstrap/hir_lower.nim similarity index 100% rename from compiler/bootstrap/hir_lower.nim rename to bootstrap/hir_lower.nim diff --git a/compiler/bootstrap/lexer.nim b/bootstrap/lexer.nim similarity index 100% rename from compiler/bootstrap/lexer.nim rename to bootstrap/lexer.nim diff --git a/compiler/bootstrap/main.nim b/bootstrap/main.nim similarity index 100% rename from compiler/bootstrap/main.nim rename to bootstrap/main.nim diff --git a/compiler/bootstrap/manifest.nim b/bootstrap/manifest.nim similarity index 100% rename from compiler/bootstrap/manifest.nim rename to bootstrap/manifest.nim diff --git a/compiler/bootstrap/parser.nim b/bootstrap/parser.nim similarity index 100% rename from compiler/bootstrap/parser.nim rename to bootstrap/parser.nim diff --git a/compiler/bootstrap/scope.nim b/bootstrap/scope.nim similarity index 100% rename from compiler/bootstrap/scope.nim rename to bootstrap/scope.nim diff --git a/compiler/bootstrap/sema.nim b/bootstrap/sema.nim similarity index 100% rename from compiler/bootstrap/sema.nim rename to bootstrap/sema.nim diff --git a/compiler/bootstrap/source_location.nim b/bootstrap/source_location.nim similarity index 100% rename from compiler/bootstrap/source_location.nim rename to bootstrap/source_location.nim diff --git a/compiler/bootstrap/token.nim b/bootstrap/token.nim similarity index 100% rename from compiler/bootstrap/token.nim rename to bootstrap/token.nim diff --git a/compiler/bootstrap/types.nim b/bootstrap/types.nim similarity index 100% rename from compiler/bootstrap/types.nim rename to bootstrap/types.nim diff --git a/library/std/Array.bux b/lib/Array.bux similarity index 100% rename from library/std/Array.bux rename to lib/Array.bux diff --git a/library/std/Channel.bux b/lib/Channel.bux similarity index 100% rename from library/std/Channel.bux rename to lib/Channel.bux diff --git a/library/std/Crypto.bux b/lib/Crypto.bux similarity index 100% rename from library/std/Crypto.bux rename to lib/Crypto.bux diff --git a/library/std/Fmt.bux b/lib/Fmt.bux similarity index 100% rename from library/std/Fmt.bux rename to lib/Fmt.bux diff --git a/library/std/Fs.bux b/lib/Fs.bux similarity index 100% rename from library/std/Fs.bux rename to lib/Fs.bux diff --git a/library/std/Io.bux b/lib/Io.bux similarity index 100% rename from library/std/Io.bux rename to lib/Io.bux diff --git a/library/std/Iter.bux b/lib/Iter.bux similarity index 100% rename from library/std/Iter.bux rename to lib/Iter.bux diff --git a/library/std/Json.bux b/lib/Json.bux similarity index 100% rename from library/std/Json.bux rename to lib/Json.bux diff --git a/library/std/Map.bux b/lib/Map.bux similarity index 100% rename from library/std/Map.bux rename to lib/Map.bux diff --git a/library/std/Math.bux b/lib/Math.bux similarity index 100% rename from library/std/Math.bux rename to lib/Math.bux diff --git a/library/std/Mem.bux b/lib/Mem.bux similarity index 100% rename from library/std/Mem.bux rename to lib/Mem.bux diff --git a/library/std/Net.bux b/lib/Net.bux similarity index 100% rename from library/std/Net.bux rename to lib/Net.bux diff --git a/library/std/Option.bux b/lib/Option.bux similarity index 100% rename from library/std/Option.bux rename to lib/Option.bux diff --git a/library/std/Os.bux b/lib/Os.bux similarity index 100% rename from library/std/Os.bux rename to lib/Os.bux diff --git a/library/std/Path.bux b/lib/Path.bux similarity index 100% rename from library/std/Path.bux rename to lib/Path.bux diff --git a/library/std/Process.bux b/lib/Process.bux similarity index 100% rename from library/std/Process.bux rename to lib/Process.bux diff --git a/library/std/Result.bux b/lib/Result.bux similarity index 100% rename from library/std/Result.bux rename to lib/Result.bux diff --git a/library/std/Set.bux b/lib/Set.bux similarity index 100% rename from library/std/Set.bux rename to lib/Set.bux diff --git a/library/std/String.bux b/lib/String.bux similarity index 100% rename from library/std/String.bux rename to lib/String.bux diff --git a/library/std/Sync.bux b/lib/Sync.bux similarity index 100% rename from library/std/Sync.bux rename to lib/Sync.bux diff --git a/library/std/Task.bux b/lib/Task.bux similarity index 100% rename from library/std/Task.bux rename to lib/Task.bux diff --git a/library/std/Test.bux b/lib/Test.bux similarity index 100% rename from library/std/Test.bux rename to lib/Test.bux diff --git a/library/std/Time.bux b/lib/Time.bux similarity index 100% rename from library/std/Time.bux rename to lib/Time.bux diff --git a/library/runtime/io.c b/rt/io.c similarity index 100% rename from library/runtime/io.c rename to rt/io.c diff --git a/library/runtime/runtime.c b/rt/runtime.c similarity index 100% rename from library/runtime/runtime.c rename to rt/runtime.c diff --git a/compiler/selfhost/main.bux b/src/Main.bux similarity index 100% rename from compiler/selfhost/main.bux rename to src/Main.bux diff --git a/compiler/selfhost/ast.bux b/src/ast.bux similarity index 100% rename from compiler/selfhost/ast.bux rename to src/ast.bux diff --git a/src/bux.toml b/src/bux.toml new file mode 100644 index 0000000..170da78 --- /dev/null +++ b/src/bux.toml @@ -0,0 +1,7 @@ +[Package] +Name = "buxc2" +Version = "0.3.0" +Type = "bin" + +[Build] +Output = "Bin" diff --git a/compiler/selfhost/c_backend.bux b/src/c_backend.bux similarity index 100% rename from compiler/selfhost/c_backend.bux rename to src/c_backend.bux diff --git a/compiler/selfhost/cli.bux b/src/cli.bux similarity index 100% rename from compiler/selfhost/cli.bux rename to src/cli.bux diff --git a/compiler/selfhost/hir.bux b/src/hir.bux similarity index 100% rename from compiler/selfhost/hir.bux rename to src/hir.bux diff --git a/compiler/selfhost/hir_lower.bux b/src/hir_lower.bux similarity index 100% rename from compiler/selfhost/hir_lower.bux rename to src/hir_lower.bux diff --git a/compiler/selfhost/lexer.bux b/src/lexer.bux similarity index 100% rename from compiler/selfhost/lexer.bux rename to src/lexer.bux diff --git a/src/main.bux b/src/main.bux new file mode 100644 index 0000000..88940f3 --- /dev/null +++ b/src/main.bux @@ -0,0 +1,23 @@ +// 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); +} +} diff --git a/compiler/selfhost/manifest.bux b/src/manifest.bux similarity index 100% rename from compiler/selfhost/manifest.bux rename to src/manifest.bux diff --git a/compiler/selfhost/parser.bux b/src/parser.bux similarity index 100% rename from compiler/selfhost/parser.bux rename to src/parser.bux diff --git a/compiler/selfhost/scope.bux b/src/scope.bux similarity index 100% rename from compiler/selfhost/scope.bux rename to src/scope.bux diff --git a/compiler/selfhost/sema.bux b/src/sema.bux similarity index 100% rename from compiler/selfhost/sema.bux rename to src/sema.bux diff --git a/compiler/selfhost/source_location.bux b/src/source_location.bux similarity index 100% rename from compiler/selfhost/source_location.bux rename to src/source_location.bux diff --git a/compiler/selfhost/token.bux b/src/token.bux similarity index 100% rename from compiler/selfhost/token.bux rename to src/token.bux diff --git a/compiler/selfhost/types.bux b/src/types.bux similarity index 100% rename from compiler/selfhost/types.bux rename to src/types.bux diff --git a/tests/borrow_test b/tests/borrow_test new file mode 100755 index 0000000..f4fb714 Binary files /dev/null and b/tests/borrow_test differ diff --git a/compiler/tests/borrow_test.nim b/tests/borrow_test.nim similarity index 100% rename from compiler/tests/borrow_test.nim rename to tests/borrow_test.nim diff --git a/compiler/tests/hir_test.nim b/tests/hir_test.nim similarity index 100% rename from compiler/tests/hir_test.nim rename to tests/hir_test.nim diff --git a/compiler/tests/lexer_test.nim b/tests/lexer_test.nim similarity index 100% rename from compiler/tests/lexer_test.nim rename to tests/lexer_test.nim diff --git a/compiler/tests/parser_test.nim b/tests/parser_test.nim similarity index 100% rename from compiler/tests/parser_test.nim rename to tests/parser_test.nim diff --git a/compiler/tests/sema_test.nim b/tests/sema_test.nim similarity index 100% rename from compiler/tests/sema_test.nim rename to tests/sema_test.nim diff --git a/compiler/tests/test_ast_fields.nim b/tests/test_ast_fields.nim similarity index 100% rename from compiler/tests/test_ast_fields.nim rename to tests/test_ast_fields.nim diff --git a/compiler/tests/test_parse_ast.nim b/tests/test_parse_ast.nim similarity index 100% rename from compiler/tests/test_parse_ast.nim rename to tests/test_parse_ast.nim diff --git a/compiler/tests/testdata/sample.bux b/tests/testdata/sample.bux similarity index 100% rename from compiler/tests/testdata/sample.bux rename to tests/testdata/sample.bux