fix(tokenizer): preserve exponent signs in compile-time expressions by jinchuntan · Pull Request #1089 · 8f4e/8f4e · GitHub
Skip to content

fix(tokenizer): preserve exponent signs in compile-time expressions - #1089

Merged
andorthehood merged 1 commit into
8f4e:mainfrom
jinchuntan:fix/scientific-expression-signs
Oct 18, 2026
Merged

andorthehood merged 1 commit into
8f4e:mainfrom
jinchuntan:fix/scientific-expression-signs

Conversation

@jinchuntan

@jinchuntan jinchuntan commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1056.

SCALE*1e-3 failed because the parser counted the exponent's minus sign as a second operator. It now keeps exponent signs with the number while VALUE-1 and 0x1E-1 still work as subtraction.

Added parser tests and a compiler fixture that runs both float32 and float64 examples. Chained expressions are still rejected.

Tested on Node 24.16.0:

  • npx nx run @8f4e/tokenizer:test --output-style=static - 473 passed.
  • npx nx run @8f4e/compiler:test --output-style=static - 324 passed.
  • npx nx run-many --target=typecheck --projects=@8f4e/tokenizer,@8f4e/compiler --parallel=1 --output-style=static - passed.

Biome and the repository pre commit checks also pass.

Recognize exponent signs within decimal operands without changing identifier or hexadecimal subtraction. Cover parser boundaries and execute float32 and float64 source regressions.

Fixes 8f4e#1056

Assisted-by: Codex
@andorthehood andorthehood added compiler Compiler, tokenizer, codegen, and language-semantics work contributor labels Oct 18, 2026

@irimias57 irimias57 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for another excellent contribution, Nigel! This fixes a subtle parser ambiguity and makes scientific-notation expressions behave reliably across the compiler. The focused parser coverage, edge-case controls, and executable float32/float64 regression test make the project more predictable and safer to evolve.

If you would like another issue, I deliberately looked further back in the backlog: #954 — Remove dead compiler block-state caches — is still open and unclaimed: #954. It is a clearly scoped compiler cleanup that would reduce duplicated internal state and make this area easier to maintain. No pressure, of course!

@andorthehood
andorthehood merged commit bac6e3d into 8f4e:main Oct 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler Compiler, tokenizer, codegen, and language-semantics work contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle exponent signs inside compile-time expressions

3 participants