From de56dc731531614ffe478b3fd0795f563a61cff5 Mon Sep 17 00:00:00 2001 From: hl-valdemar Date: Mon, 13 Jul 2026 14:08:52 +0200 Subject: [PATCH] makefile --- Makefile | 9 +++++++++ README.md | 2 +- compiler/loader/loader.odin | 5 +++-- compiler_tests.odin | 4 ++-- examples/packages/basic/app/{value.bro => value.hon} | 0 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 Makefile rename examples/packages/basic/app/{value.bro => value.hon} (100%) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4e010f8 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +.PHONY: build install + +build: + mkdir -p build + odin build . -out:build/brolang + +install: build + install -d "$(HOME)/.brolang/bin" + install -m 755 build/brolang "$(HOME)/.brolang/bin/bro" diff --git a/README.md b/README.md index 9626f63..d46ac0b 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ backend failures return status `2`. Top-level function bodies are semantically checked lazily when a concrete specialization is demanded. -Every immediate `.bro` file in the input directory belongs to the root +Every immediate `.bro` or `.hon` file in the input directory belongs to the root package. Imports are relative directory paths and are local to the file that declares them. Imports beginning with `@` resolve from the project root: diff --git a/compiler/loader/loader.odin b/compiler/loader/loader.odin index 51b5331..cc8267c 100644 --- a/compiler/loader/loader.odin +++ b/compiler/loader/loader.odin @@ -87,7 +87,8 @@ read_package_files :: proc(state: ^State, path: string) -> ([]os.File_Info, bool files: [dynamic]os.File_Info files.allocator = state.allocator for entry in entries { - if !entry.is_dir && filepath.ext(entry.name) == ".bro" { + extension := filepath.ext(entry.name) + if !entry.is_dir && (extension == ".bro" || extension == ".hon") { append(&files, entry) } else { os.file_info_delete(entry, state.allocator) @@ -1170,7 +1171,7 @@ load_package :: proc(state: ^State, path: string, import_span: source.Span, is_r if is_root { state.root_failed = true } else { - source.addf(state.diagnostics, import_span, "package '%s' contains no readable .bro files", canonical) + source.addf(state.diagnostics, import_span, "package '%s' contains no readable .bro or .hon files", canonical) state.module.packages[pkg_id].available = false } os.file_info_slice_delete(files, state.allocator) diff --git a/compiler_tests.odin b/compiler_tests.odin index 72eca32..3598905 100644 --- a/compiler_tests.odin +++ b/compiler_tests.odin @@ -855,7 +855,7 @@ lexer_diagnoses_invalid_import_strings :: proc(t: ^testing.T) { } @(test) -package_loader_discovers_lexical_immediate_bro_files :: proc(t: ^testing.T) { +package_loader_discovers_lexical_immediate_source_files :: proc(t: ^testing.T) { sources := source.init_store() defer source.destroy_store(&sources) diagnostics := source.init_store_diagnostics(&sources) @@ -870,7 +870,7 @@ package_loader_discovers_lexical_immediate_bro_files :: proc(t: ^testing.T) { testing.expect_value(t, len(module.packages), 2) testing.expect_value(t, len(module.files), 3) testing.expect(t, strings.has_suffix(sources.items[module.files[0].source].path, "/main.bro")) - testing.expect(t, strings.has_suffix(sources.items[module.files[1].source].path, "/value.bro")) + testing.expect(t, strings.has_suffix(sources.items[module.files[1].source].path, "/value.hon")) testing.expect(t, strings.has_suffix(sources.items[module.files[2].source].path, "/math.bro")) } diff --git a/examples/packages/basic/app/value.bro b/examples/packages/basic/app/value.hon similarity index 100% rename from examples/packages/basic/app/value.bro rename to examples/packages/basic/app/value.hon