-
Notifications
You must be signed in to change notification settings - Fork 112
DO NOT MERGE: Bootstrap prototype #596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for the write up! This clears up a misunderstanding from me: I thought using JSCL instead of other CL to compile JSCL is rather an exercise on conformance than bootstrap (because any conforming CL should be able to compile JSCL). But turns out it is indeed an exercise on bootstrap because we need to handle clashing between host/target JSCL package, etc.
I think
At some point we need to overhaul the reader, but I repeat myself :) A conforming reader is required to be thoroughly |
|
Any suggestions for compiling on |
What are the main limitations now? the lack of shell? I guess WLS or just doing the build in sbcl directly like Or is there any additional limitations? I imagine paths might be quite broken now. But something we should fix. Let's think about it when I open a PR to improve the build system to allow specify jscl as a host. |
|
A mismatch in bootstrapping was caused by this
Kind of funny! Thank you JS prototype chain. Prelude.js was good but packages created from package.lisp weren't. Probably good to migrate packages to use hash tables /map too at some point. |
|
Claude was almost completely useless for these bootstrapping issues. Can't grasp the root cause of the issues ever. It always suggests to add It only helped me to compare It makes it more fun though. It's quite cool to hack inside |
|
Ok! jscl.lisp is compiling itself now 🎉 There were quite a few hacks. Especially defstruct.lisp vs structures. Many tests are still failing
but it's at the point where I build jscl from jscl and I get a pretty close jscl.js and a functioning REPL. It might be a lot of effort to recreate individual PRs. Maybe it's better to refine this one and fix or create issue to solve all the hacks that were needed. |
c997986 to
9ae72af
Compare
Does it make sense to split out the part that implements functionality (i.e. improve conformance, like the I think conceptually the following goals are in order:
Improvements in 2 will probably reduce hacks needed in 3. And it does seem you completed some tasks in 2 in order to make 3 work! I think if we separate them out and consider it under premise of 2, it's easier to review and produce good code. No hacks or magic required in 2! |
e226846 to
8805168
Compare
|
Let me work on rebasing the PR and try to clean up the commits a bit to try to match that order, and make sure tests (at least the Some of my fixes can be merged but others are very hacky, def!struct and reader for instance. And I'd prefer if we do them properly. I'll try to extract the good stuff from it. |
10845d1 to
d67fd6e
Compare
This is a pull request just to keep track of obstacles for boostrapping.
I will not merge this as is. I do not plan to make
make.shbootstrap in two stages anymore, but instead to provide./make.sh --sbcland
./make.sh --jscl=<path>so we can build jscl with sbcl or itself. Similarly for
run-tests.sh.However, I will probably provide some script to bootstrap the full system as a test and part of the CI.
I will open small PRs to apply some of these changes more incrementally and cleanly.
Status
./make.shis (temporarily) generatingout/jscl-xc-node.jsas usual with sbcl. After that, innode out/jscl-node.jsI can do:However when running
out/test.js, there is an error when loading toplevel.lisp (the last file!), complaining that*environment*is undefined.List of changes
JSCL-XC package
Define all jscl into a package
jscl-xc. This package exists since(load "jscl.lisp")all the way until the .js file is loaded. And only at the very end, packages are renamed to their final name.This is for simplicity. I tried reading
jscl-xcbut changing the target package in dump-symbol but it got tricky.jscl-target feature
Introduce a feature
#+jscl-target. Equivalent to our existingjscl-xc. But I wanted to avoidxc (crosscompile). Because from jscl -> jscl is not technically cross compiling, but bootstraping. Anyway. I can rename it later.Most of the flags are changed to use
#+jscl-targetexcept one in load.lisp I think. Most of src/ should be host independent, so it's natural. We just care about if we are bootstrapping or not.jscl.lispwill care more about the host though, as it needs to run git and do some external things.Macro readers
Add basic macro reader characters.
This is using still the JS placeholder layer and
#jexplicit macro reader, even when the host is jscl instead of sbcl. I thought it is nicer to have a single path, and only use CL standard infrastructure from the host.This is nice because for example, we might want to change FFI. But JSCL should always provide a (close to) standard CL.
with-compilation-unitDoes load also need to delay warnings?
(setf macro-function)Some defstruct fixes
740644c Fix defstruct predicate
617f51a Fix: defstruct should define a type
Problems
Undefined
*environment*.It's caused by def!struct not creating real classes:
When bootstraping itself from jscl, the first branch is fine. But the second one will not work.
You can see this if you go to the REPL in master and try this: