Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## [feature] — 2026-03-23
- Implemented full import system for Rey with compile-time resolution.
- Added `export pub` function modifier and import visibility enforcement:
- `export pub func` => importable
- `pub func` => not importable
- `func` => private
- Added parser/AST support for:
- `import file.symbol`
- `import file.{a,b}`
- `import module`
- `import module::file`
- `import module::{a,b}`
- Added import resolver pipeline (`compiler/v1/src/imports.rs`) and integrated it into compiler entry flow.
- Implemented resolver lookup order:
1. current file directory
2. project root (entry file directory)
3. `~/.reyc/std/src` for `std` prefix
4. `~/.reyc/packages`
- Added module semantics:
- `module/main.rey` required for `import module`
- module namespace auto-collects all `export pub` functions from `.rey` files in folder
- `module::file` resolves direct file namespace
- Added import diagnostics for:
- file not found
- missing module `main.rey`
- function not found
- function is `pub` but not `export pub`
- circular imports
- duplicate imports
- Added runtime/typecheck namespace dispatch support for `namespace.func()`.
- Added import fixtures under `tests/imports/` for success and all required error cases.

## [release] — 2026-03-19
- Shipped `rey v0.0.7-pre`
- Added `projects/fake-cli/cli.rey` - a full interactive TUI implementation in Rey.
Expand Down
5 changes: 4 additions & 1 deletion compiler/v1/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ pub mod ty;

pub use expr::Expr;
pub use literal::Literal;
pub use stmt::{FieldDecl, ForIterator, MatchArm, MethodDecl, Parameter, Pattern, Stmt};
pub use stmt::{
FieldDecl, ForIterator, FunctionVisibility, ImportKind, MatchArm, MethodDecl, Parameter,
Pattern, Stmt,
};
pub use ty::Type;
20 changes: 20 additions & 0 deletions compiler/v1/src/ast/stmt.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::{Expr, Literal, Type};
use crate::lexer::span::Span;

#[derive(Debug, Clone, PartialEq)]
pub struct Parameter {
Expand All @@ -25,6 +26,20 @@ pub struct MethodDecl {
pub is_static: bool,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FunctionVisibility {
Private,
Pub,
ExportPub,
}

#[derive(Debug, Clone, PartialEq)]
pub enum ImportKind {
FileSymbols { module: String, symbols: Vec<String> },
ModuleNamespace { module: String },
ModuleItems { module: String, items: Vec<String> },
}

#[derive(Debug, Clone, PartialEq)]
pub enum Stmt {
VarDecl {
Expand All @@ -35,6 +50,7 @@ pub enum Stmt {
},
FuncDecl {
name: String,
visibility: FunctionVisibility,
params: Vec<Parameter>,
return_ty: Option<Type>,
body: Vec<Stmt>,
Expand All @@ -44,6 +60,10 @@ pub enum Stmt {
fields: Vec<FieldDecl>,
methods: Vec<MethodDecl>,
},
Import {
kind: ImportKind,
span: Span,
},
If {
condition: Expr,
then_branch: Vec<Stmt>,
Expand Down
Loading
Loading