refactor: organize parser into modular components #263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR performs a major refactoring of the parsing logic by decomposing the monolithic
parser.rsand the auxiliarytype_system.rsinto a well-structured directory of specialized submodules. This change significantly improves the maintainability and navigability of the frontend logic.Key Changes
1. Parser Modularization
The parser has been split into the following submodules within
front/parser/src/parser/:asm.rs: Logic for parsing inline assembly blocks (asm { ... }).control.rs: Handles control flow structures includingif,while, andforloops.decl.rs: Consolidates variable and constant declarations (const,let,mut,var).expr.rs: Manages expression-related parsing such as function calls and grouped parentheses.functions.rs: Handles function definitions, parameter lists, and body extraction.io.rs: Logic for I/O statements includingprint,println, andinput.items.rs: Parsing for top-level items such asimport,proto, andstruct.stmt.rs: Generic statement handling, including assignments and block parsing ({ ... }).types.rs: Consolidated type parsing logic (moved from the now-deletedtype_system.rs).parse.rs: The primary entry point containing the mainparse()function.2. Cleanup & Integration
front/parser/src/parser/type_system.rsand integrated its logic intoparser/types.rsto keep type-related parsing logic in one place.mod.rsto export the new module structure and refactored imports across thewaveccrate (specifically inmain.rsandrunner.rs) to resolve warnings and ensure compatibility with the new structure.Impact
parser.rs.