You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor AST→value conversion onto one converter with two sinks #133
src/interpreter/stdlib/parser.cxx (~950 lines) walks the C++ AST and builds interpreter ValuePtrs directly — Value::variant("Call", "Parser.Expression", {...}) and friends. To reach BEAM (#134) the same tree has to be produced as an Erlang term, and the fidelity work (#135) has to extend both.
Written as two independent walkers, they drift: an Expr variant added to one is silently missing from the other, and the failure shows up as a Kex program that behaves differently under -R than under the interpreter.
What lands
The convert* functions are restated against a builder interface — roughly variant(tag, parent, args), record(name, fields), list, string, integer, floating, atom, none, just — with the AST walk written once against it.
Term gains the arms it lacks: a Float arm (NEW_FLOAT_EXT, tag 70) and bignum encoding (tags 110/111) for integers outside int64_t. It currently has only Int, because a KexI chunk never needed more.
Why it is separate
It ends with zero user-visible change — tools/docgen/docgen.kex must produce byte-identical output before and after. That makes it cheap to review and cheap to revert, and it is the single change that makes every later stage cost one implementation instead of two.
Verification
make test-all.
Docgen output diffed before/after across the prelude — must be identical.
Unit tests for the new Term arms: a float round-trips through encodeEtf/decodeEtf, and an integer beyond int64_t range round-trips as a bignum.
Activity
Add more tests, fixes #133, #134