Repository navigation
Separate semantic source frontend from legacy x64 emission - #17
Draft
Papishushi wants to merge 1 commit into
Draft
Papishushi wants to merge 1 commit into
Papishushi wants to merge 1 commit into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 29 |
| Duplication | 2 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Papishushi
force-pushed
the
feat/semantic-source-frontend-v0
branch
from
October 15, 2026 21:40
62dc976 to
3b134fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Removes the final hidden source-to-x64 computation from the portable pipeline, stacked on #16.
Semantic frontend
Adds
SourceCompiler.CompileSemantic(...), which performs source-level work without invoking a native backend:It returns
SourceSemanticCompilation(Module, PortableContracts). The result deliberately exposes noAssembly, native entry label, host adapter, or other native artifact surface.Shared architecture-neutral validation
A first version that merely skipped
module.Compile(...)would have silently lost semantic checks historically buried inside the legacy emitter. This PR therefore extracts reusable validation fromFunctionEmitter:VARframe constructionRETURNtype checksLOAD/STOREsymbol resolutionSTOREto readonly/const frame bindingsFunctionEmitter.Validate(...)performs those checks without emitting NASM.FunctionEmitter.Compile(...)reuses the same frame and validation helpers before entering native optimization/code generation, preventing the semantic and legacy paths from drifting.Legacy backend retained explicitly
SourceCompiler.Compile(...)keeps its existing public signature and behavior. It now reuses the same parsed semantic state before entering a dedicated legacy-native emission phase, so compatibility remains intact while the backend boundary becomes explicit.Portable pipeline
PortableSourceX64Pipelinenow consumesCompileSemantic(...)directly:There is no legacy NASM artifact to compute or discard anymore.
The semantic frontend also receives the real
processImagemode, rather than pretending every portable compilation is a library merely to suppress the legacy_startemitter. Process/library contract validation is therefore independent from native code generation.Tests
SourceSemanticCompilationexposes onlyModuleandPortableContracts_startemitter rejects the source, demonstrating that no native emitter was invokedSTOREto a readonly frame bindingValidation
Head
5f7cc720passed Windows and Ubuntu.NET, including the complete Linux native regression corpus, plus CodeQL, Codacy and DocFX while temporarily targeted atmain.The first Isolation attempt hit a pre-existing race in
prototypes/isolation/run_program.py:/proc/<pid>/statdisappeared between path construction andread_text(), raisingProcessLookupError. Re-running the identical job on the identical SHA passed the previously failingCalls originating in Ubytec modulesstep and the complete Isolation suite. No compiler change was required.The PR is restored to its proper stacked base #16. Its focused diff is four files: semantic frontend, shared callable validation, portable pipeline wiring, and dedicated tests.
Next boundary
The independent raw UBCM verifier still validates wire structure, indices and operand contracts but does not yet independently simulate evaluation-stack depth or enforce readonly frame writes. Those properties are representable in indexed UBCM, so the next milestone is to move equivalent guarantees to the binary trust boundary before making the portable path the normal/default CLI route.