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