Repository navigation
Conversation
Compiler: - transpiler: emit fasm x86_64 assembly directly (stack-slot frame model, System V call ABI, azfn_ label prefix, string data dedupe, fasm local branch labels, \\n/\\t/\\r/\\0/\\\\ escapes resolved at emission) - validator: link_files is now (operation, source path); only invoked @link operations are included, each path exactly once - pipline: single fasm invocation, BackendError::Fasm; qbe/as/ld.lld, .il/.ssa/.o intermediate stages and the external linker are gone - compiler: builds one .asm (header, filtered includes, code, data) and fasm assembles+links it straight into a standalone ELF Parser/tokenizer fixes found by e2e: - &&/|| dispatch (previously an infinite loop in read_operator) - '='/'!' peek guards (!flag parsed the identifier away) - binary op over call results (f() + g()) fell through the LParen path - loop bodies parsed as statements (previously never parsed their body) - validator now validates loop bodies Tests: repair the broken-at-HEAD suite (38 compile errors), stale func keyword test, duplicate-func expectation -> all 18 test suites green Tooling/docs: - CI: install fasm, checkout submodules - gitignore: *.ssa, *.asm, /sdk/ fix (azlang-docs/src/sdk/ was ignored), book output; git rm tracked compiler binaries and .s/.ssa artifacts - docs: qbe.md -> fasm.md, assembly_linking.md -> direct_assembly.md, real measured sizes (198/228 byte hello world), ./sdk/src/*.s @link
Member
Author
|
it looks great but I can't merge this pr. Because it's vibe coded |
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
Replaces the whole code-generation/linking chain (
qbe→.il→as→.o→ld.lld) with a single-pass fasm pipeline: the compiler emits one.asmfile, andfasmassembles and links it directly into a standalone ELF. No object files, no separate linker, no LLVM/QBE toolchain — the only external dependency is fasm.qbe+as+ld.lldfasm(one invocation).il→.s→.o→ binary.asm→ binary@link= prebuilt.ofiles +sdk/build.sh@link= fasm sourceinclude(no build step)What's changed
Backend
crates/transpiler: full fasm emitter — stack-slot frame model (16-byte aligned), System V AMD64 call ABI (≤6 args in registers, overflow on stack),azfn_user-function labels (avoids fasm reserved-word collisions likeadd), string data dedupe, fasm local branch labels, escape sequences (\\n,\\t,\\r,\\0,\\\\) resolved at emissionvalidator:link_filesis now(operation, source path); only operations actually called get their source included, each path exactly oncecompiler: builds a single.asm(header → filtered includes → code → data) and runsfasm;BackendError::Fasmsurfaces fasm stderrsdk: assembly stubs are fasm syntax,lib.az@link→./sdk/src/*.s,build.shremovedBugs fixed along the way (found by e2e)
&&/||caused an infinite loop inread_operator;=/!peek guard ate the first char of the next token (!flag→lag)f() + g()/return f() + g()fell through the call path;loopbodies were never parsed\\netc. never worked in data emission (old QBE path handled it)Tests
The suite did not compile at
mainHEAD (38 errors, pre-existing — verified against a clean worktree). Repaired the validator/tokenizer tests against the current API; all 18 test suites are green now.Tooling & docs
fasm, checks out submodules.gitignore:*.ssa,*.asm,/sdk/anchoring (azlang-docs/src/sdk/*.mdwas accidentally ignored), book output; tracked compiler binaries/.s/.ssaartifacts removed from gitqbe.md→fasm.md,assembly_linking.md→direct_assembly.md, all@linkexamples →./sdk/src/*.s, diagrams/pipeline rewritten,mdbook buildpassesMeasured (not estimates)
examples/hello_world.az@link, escapes)file: ELF 64-bit LSB executable, x86-64, statically linked, no section header — 1 program header, no dynamic interpreter.Companion PR for the SDK submodule must merge first: AzLangProgramingLanguage/AzLang-Std#1 (this PR's
sdkgitlink points at273f2b0on itsfasm-sdkbranch).Testing
cargo test --workspace— 18 suites, all greenazcli build+ run for: hello world (198B), docs example (228B), integration program covering modules, recursion,while/loop/break/continue,if/elif/else, div/mod,&&, string==,exit— all assertions pass, exit 0mdbook buildpasses