refactor: modularize expression codegen and enhance test runner infrastructure #260
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 focuses on improving the maintainability of the LLVM backend and increasing the reliability of the integration test suite. It decomposes the massive
expression.rsfile into a modular sub-structure and upgrades the test runner with advanced error detection and interactive input support.Key Changes
1. Expression Codegen Modularization
The monolithic
expression.rshas been broken down into a structured hierarchy withinexpression/rvalue/. This separation of concerns makes the IR generation logic significantly easier to navigate and extend.dispatch.rs: Central routing for all expression types.literals.rs,variables.rs,structs.rs: Handling of data and memory resolution.binary.rs,unary.rs,incdec.rs: Arithmetic and logical operation logic.calls.rs,assign.rs,index.rs: Function execution and complex assignments.pointers.rs,asm.rs: Low-level memory and inline assembly operations.ExprGenEnvinmod.rsto pass LLVM context and builder references consistently across sub-modules.2. Enhanced Test Runner (
run_tests.py)The integration test script has been upgraded from a simple execution wrapper to a robust diagnostic tool.
looks_like_fail()logic. Even if a process exits, the script now scansstderrfor keywords likeWaveError,panicked, orSegfaultto catch hidden compiler crashes or semantic errors.3\n) fortest22.wave, allowing theinput()function to be tested in a non-interactive CI environment.