Skip to content

Implement module system and program flattening#337

Open
LesterEvSe wants to merge 10 commits into
masterfrom
dev/modules
Open

Implement module system and program flattening#337
LesterEvSe wants to merge 10 commits into
masterfrom
dev/modules

Conversation

@LesterEvSe
Copy link
Copy Markdown
Collaborator

@LesterEvSe LesterEvSe commented May 29, 2026

Overview

Implements the module system proposed in #318, enabling multi-file programs to be compiled into a single entry point for browser execution via Simplex.

Changes

  • Driver: Each imported file is now wrapped in a mod unit_N { ... } block during flattening, preserving namespace boundaries and visibility rules
  • Analyzer: added ModuleScope and scope-aware resolution to handle nested modules, visibility checks, and use rewriting across module boundaries

Supported Syntax

pub mod foo { ... }          // visibility
mod outer { mod inner { } }  // nesting
use crate::foo::bar;         // explicit import

Related PRs (in order of the merge): #338, #339, #343, #345

@LesterEvSe
Copy link
Copy Markdown
Collaborator Author

LesterEvSe commented Jun 5, 2026

Next Steps After Merging:
We expect the modules feature to be marked as unstable in PR #329.
After merging this and the Unstable Features PR, we plan to bump the SimplicityHL version to 0.6.0-rc.1.

@LesterEvSe LesterEvSe marked this pull request as ready for review June 5, 2026 13:30
Copy link
Copy Markdown
Collaborator

@KyrylR KyrylR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 4359a84; based on the ACKs in: #338, #339, #343, #345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support mod keyword with Namespaces

2 participants