Skip to content

v1.2.32

Latest

Choose a tag to compare

@github-actions github-actions released this 19 May 23:39

Cleaner transpiled output

Both --emit c and --emit js gain a small post-pass that strips
block and line comments and collapses blank lines from the emitted
source. Same code, less noise.

hello.xs (1 line)
--emit c before 2329 lines, 88 KB
--emit c after 2054 lines, 78 KB
--emit js before 931 lines, 47 KB
--emit js after 926 lines, 47 KB

JS already had a dense prelude so its gain is marginal; the real win
is on the C side.

How the pass works

compact_emitted walks the emitted string once, character by character:

  • /* ... */ block comments are removed (including multi-line ones).
  • // ... line comments are removed.
  • Lines that end up empty after stripping are collapsed.
  • Multiple consecutive blank lines collapse to nothing.
  • Trailing whitespace on every line is stripped.

It is aware of string literals ("...", '...', and for JS template
strings \ ... ```) so comment-looking content inside a string
literal survives intact.

No code is rewritten, no helpers are removed, no behaviour changes.
Programs that compiled before still compile; programs that ran
before still run with the same output.

Tests

tests/run.sh 50/50, tests/run-all.sh 7/7 layers, tests/test_corpus_matrix.sh 60/60.