Repository navigation
comp.ts: nothing reads emitted text, pure mains print through Bend - #1817
Open
nicolas-abril wants to merge 1 commit into
Open
nicolas-abril wants to merge 1 commit into
nicolas-abril wants to merge 1 commit into
Conversation
The simplification half of bendlang#1601, on main's pass loop: compile_book still emits every def again until a pass adds no fact. - Facts are one set of strings (own, stat, ctr, type, fam, arg, open) read through fact(), replacing Hot, FL.stat, FL.own, the brws memo and the reset of ten fields per pass; a fact that only leads to others is an implication (fact_when). Each def and spin keeps its own output. - A value carries the borrowed root of each box (Val.rs); a Nat's Succs are counted on the term (nat_peel); a table's rows are words on both lanes, folded on values, and an op's JS runs on them only if it calls nothing past Math.fround and Math.imul; a local is a name name_local made; an op's argument is held unless it is a variable or a constant (op_bare); a JS call that waits on its callee calls its entry ($$k); a JS closure captures what is free in it. - A match arm that rebuilds its scrutinee reads it (arm_self), so JS needs no views. - A pure main prints through a Bend printer of main's value (main_pure), instead of a descriptor and a C and a JS printer; Base gains Char.quote, String.quote, F32.show.dot, U32.hex, Array.write and Array.show. JS holds stdout off a terminal and writes it before a wait, an error, an exit, a File.write or at 64 KiB. - The term caches live as long as the file; the fold cache is cleared per def. Reserved names are refused before anything else, on both lanes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
The simplification half of #1601, split out so it can be reviewed apart from the compile-speed change (#1601, which goes on top of this).
compile_bookkeeps main's loop: it emits every def again until a pass adds no fact.comp.ts is 66,209 ttok against main's 66,000, over the 66,000 cap, so the repo gate fails (53/54) until the cap moves or 209 more come out. Test gate: 1715/1715 on the cluster.
Facts are one set
own,stat,ctr,type,fam,argandopenare strings in one set read throughfact(), replacingHot,FL.stat,FL.own, thebrwsmemo and the hand-written reset of ten fields per pass. A fact that only leads to other facts is an implication (fact_when), not a dependency.Nothing reads the text it emitted
Val.rs), replacing a lookup of the word's string in a scope map. A read-only walk owns its list when a sum type puts an unboxed field where another constructor has a boxed one #1805's rule (only a box roots) sits inval_new.nat_peel), not by regexes over emittednat_chk(... + n).Math.froundandMath.imul. The C lane no longer runs JS text that the JS lane printed.name_localmade, not a name's shape. An op's argument is held in a local unless it is a variable or a constant (op_bare), replacing the bracket counting.$$k), declared after the last def, instead of a marker rewritten by a regex over the finished program. A JS closure captures the variables free in its term. A line is indented as it is pushed.Match arms that rebuild their scrutinee read it
arm_selfreads each such rebuild as the scrutinee itself; an arm that no longer reads its fields binds none.FL.views,js_view,word_u32go).A pure main prints through Bend code
main_purewrites it as Bend source, parses it into a copy of the book and checks it. The printer writes as it goes, so a 3M-elementList<U32>peaks at 49.6 MB on C as on main (49.4 MB); an Array of Data is read in place by index (Array.writeon C,Array.showon JS). A pure main prints imported types too.Char.quote,String.quote,F32.show.dot,U32.hex,Array.writeandArray.show.File.writeor at 64 KiB.Smaller things
lay_eqwalks the layout DAG instead of comparing JSON. Reserved names are refused before anything else, on both lanes.Compile time (C and JS emit, median of 5, M4 Max): boss_3d 1,127 ms on main, 587 ms here; the 35 demos and benches that build, 3.04 s → 1.89 s in total.
Verification
f32_table_math_op,f32_neg_const_js,const_array_op_js,array_elements,imported_adt,imported_adt_alias,stdout_file_order.🤖 Generated with Claude Code