Skip to content

Conversation

@kchanqvq
Copy link
Member

@kchanqvq kchanqvq commented Dec 8, 2025

This ports the full FORMAT implementation from CMUCL to JSCL!!!

Also implemented proper compiler macro. Using the compiler macro, the full FORMAT implementation (essentially compiler-only) is even faster than the previous incomplete FORMAT implementation (interpreter-only) at run time. tests.js runs about 20% faster on node.

Some of this might be attributed to codegen.lisp now use simple-format instead of format. This is necessary for bootstrapping (the compiler-only FORMAT implementation has to call the compiler). But IMO this is also cleaner because codegen.lisp absolutely don't need the full functionality of FORMAT, and this makes bootstrapping dependency simpler.

More details about the port (copied from my comments at the top):

  • The interpreter is removed, leaving a compiler-only implementation.
  • The floating point printer is replaced with a crude approximation using JavaScript toString/toFixed. The Dragon4 algorithm in CMUCL requires BigInt, so we can't use it for now.
  • ~T simply writes #\Tab. We need stream-line-column to implement it properly.
  • Pretty printer stuff are commented out because we don't have a pretty printer

@davazp
Copy link
Member

davazp commented Dec 8, 2025

Amazing stuff. Do we need to keep some license notice or something below the GPL to keep credit to CMUCL?

@kchanqvq
Copy link
Member Author

kchanqvq commented Dec 8, 2025

Amazing stuff. Do we need to keep some license notice or something below the GPL to keep credit to CMUCL?

I credited CMUCL in my top level comment. I don't think we need to reproduce any notice because CMUCL is public domain. SBCL also just has a single sentence crediting CMUCL.

@kchanqvq kchanqvq merged commit 5a4c175 into jscl-project:master Dec 9, 2025
1 check passed
@kchanqvq kchanqvq deleted the format branch December 21, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants