fix: module syntax — changed src_bux/*.bux from module X; to module X { ... }

This commit is contained in:
2026-05-31 14:14:42 +03:00
parent 3c2a6e68b9
commit f4de065160
15 changed files with 632 additions and 628 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
// ast.bux — AST node types (Expr, Stmt, Decl, Pattern, TypeExpr)
module Ast;
module Ast {
// ---------------------------------------------------------------------------
// SourceLocation (inline for convenience)
@@ -351,4 +351,4 @@ func Ast_MakeDecl(kind: int, line: uint32, col: uint32) -> Decl {
aliasType: null as *TypeExpr,
extFuncDll: "", extFuncVariadic: false, extFuncRetType: null as *TypeExpr,
childDecl1: null as *Decl, childDecl2: null as *Decl };
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
// c_backend.bux — C transpiler backend (ported from c_backend.nim)
// Generates C code from the HIR.
module CBackend;
module CBackend {
// ---------------------------------------------------------------------------
// Type → C type name
@@ -262,4 +262,4 @@ func CBackend_Generate(mod: *HirModule) -> String {
func CBackend_Free(cbe: *CEmitter) {
StringBuilder_Free(&cbe.sb);
bux_free(cbe as *void);
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
// cli.bux — CLI driver for the Bux self-hosting compiler
// Wires together: Lexer → Parser → Sema → HirLower → CBackend
module Cli;
module Cli {
extern func PrintLine(s: String);
extern func Print(s: String);
@@ -164,4 +164,4 @@ func Cli_Run(args: *String, argCount: int) -> int {
Print("Unknown command: ");
PrintLine(cmd);
return 1;
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
// hir.bux — HIR (High-level Intermediate Representation) node types
module Hir;
module Hir {
// HIR node kinds
const hLit: int = 0;
@@ -187,4 +187,4 @@ func Hir_MakeStore(ptr: *HirNode, value: *HirNode, line: uint32, col: uint32) ->
n.child1 = ptr;
n.child2 = value;
return n;
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
// hir_lower.bux — HIR lowering: AST → HIR transformation (ported from hir_lower.nim)
// Transforms the typed AST into a lower-level IR suitable for code generation.
module HirLower;
module HirLower {
// ---------------------------------------------------------------------------
// Lowering context
@@ -305,4 +305,4 @@ func HirLower_Free(ctx: *LowerCtx) {
bux_free(ctx.funcs as *void);
bux_free(ctx.externFuncs as *void);
bux_free(ctx as *void);
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
// lexer.bux — Lexer state machine (ported from lexer.nim)
// Tokenizes Bux source into a stream of tokens.
module Lexer;
module Lexer {
extern func bux_strlen(s: String) -> uint;
@@ -693,4 +693,4 @@ func Lexer_Free(lex: *Lexer) {
bux_free(lex.tokens as *void);
bux_free(lex.diags as *void);
bux_free(lex as *void);
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
// main.bux — Entry point for the Bux self-hosting compiler
module Main;
module Main {
// Forward declaration from Cli module
func Cli_Run(args: *String, argCount: int) -> int;
@@ -9,4 +9,4 @@ func Main() -> int {
// For now, just show version info
var emptyArgs: *String = null as *String;
return Cli_Run(emptyArgs, 0);
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
// manifest.bux — Manifest parser for bux.toml files
// Parses package metadata: name, version, type, build output.
module Manifest;
module Manifest {
// ---------------------------------------------------------------------------
// Manifest struct
@@ -82,4 +82,4 @@ func Manifest_Parse(content: String) -> Manifest {
func Manifest_Load(path: String) -> Manifest {
let content: String = ReadFile(path);
return Manifest_Parse(content);
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
// parser.bux — Recursive descent parser (ported from parser.nim)
// Parses Bux source tokens into an AST.
module Parser;
module Parser {
extern func bux_strlen(s: String) -> uint;
@@ -1002,4 +1002,4 @@ func Parser_DiagCount(p: *Parser) -> int {
func Parser_Free(p: *Parser) {
bux_free(p.diags as *void);
bux_free(p as *void);
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
// scope.bux — Symbol table with parent-chain lookup
module Scope;
module Scope {
// Symbol kinds
const skVar: int = 0;
@@ -89,4 +89,4 @@ func Scope_LookupLocal(scope: *Scope, name: String) -> Symbol {
func Scope_Free(scope: *Scope) {
bux_free(scope.symbols as *void);
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
// sema.bux — Semantic analysis (type checker, ported from sema.nim)
// Validates types, resolves identifiers, checks function calls.
module Sema;
module Sema {
// ---------------------------------------------------------------------------
// Sema context
@@ -391,4 +391,4 @@ func Sema_Free(sema: *Sema) {
bux_free(sema.scope as *void);
bux_free(sema.diags as *void);
bux_free(sema as *void);
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
// source_location.bux — Source position tracking
module SourceLocation;
module SourceLocation {
struct SourceLocation {
line: uint32,
@@ -9,4 +9,4 @@ struct SourceLocation {
func SourceLocation_New(line: uint32, column: uint32, offset: uint32) -> SourceLocation {
return SourceLocation { line: line, column: column, offset: offset };
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
// token.bux — Token kinds and helpers
module Token;
module Token {
// ---------------------------------------------------------------------------
// TokenKind enum
@@ -310,4 +310,4 @@ func Token_KindName(kind: int) -> String {
if kind == tkNewLine { return "newline"; }
if kind == tkEndOfFile { return "end of file"; }
return "unknown token";
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
// types.bux — Type system definitions and factories
module Types;
module Types {
// ---------------------------------------------------------------------------
// TypeKind constants
@@ -184,4 +184,4 @@ func Type_ToString(t: Type) -> String {
if t.kind == tkTypeParam { return t.name; }
if t.kind == tkPointer { return "*" + t.innerName1; }
return "?";
}
}