Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I see it's self-hosted. How much code needs to be written in another language in order to bootstrap the whole thing?


In Javascript it would be probably around 250 lines: the current VM is 500 but that includes extra stuff for performance, and system stuff like math and timers that aren't part of the core language.

This depends a lot on the host language. BQN requires garbage collection because it has closures so an implementation in a language without it needs to include a GC. JS has a lot of conveniences like closures of its own, and the ability to tack properties onto anything, so even other high-level hosts would generally take more code.


I'm thinking Julia could be a good fit. It's garbage collected, pretty fast, and designed for numerical work.


And Julia has APL.jl, implementing APL within Julia, with the beautiful APL characters, using string macros. This library might contain some ideas for implementing your array language.


Agree with both of you: I've been planning to do an embedded BQN for Julia (as well as finish my NumPy one), and having found APL.jl in this thread it looks like a pretty good resource. There are some missing syntax features in the compiler that I'd like to finish first.

If anyone else is interested in working on a Julia VM I think this would be a pretty cool project, and a nice way to learn some of how bytecode interpreters are implemented without getting into the weeds in a low-level language. Join the forums and ask about it!


An implementer might want to use

https://juliafolds.github.io/Transducers.jl/dev/


Thanks for your work on BQN Marshall. Can it run on the desktop though? I know little about JS, but kind of assume it needs a browser? My only experience with JS on the desktop is via bloated electron apps. I always thought a single file executable would be best. Is that possible?


There are multiple VMs. The JS one does run offline with Node.js (it's one file to implement BQN and one for Node-specific stuff like command-line and filesystem interaction), but it's not designed for speed. CBQN is what you want. EDIT: Just run make, which will pull from a bytecode branch if necessary. It doesn't ship with bytecode, so currently you have to bootstrap once with either dzaima/BQN or Node; at some point I'm sure we'll publish a full release that can be compiled with C alone for bootstrapping.

Further details at https://mlochbaum.github.io/BQN/running.html, and feel free to contact me or join the forums for help getting set up!


EDIT: No longer necessary; see edit above.

Updated this gist, so you can also copy the bytecode (into the commented files in src/gen in the CBQN repository) from here: https://gist.github.com/mlochbaum/7208fa5a4dd767102f9a99b363...


Thanks for reaching out. I'll def keep watching the project. Really happy to see there is a C version.

What is the roadmap for I/O and common data formats support on the C side (like csv, json, xml...etc), or do you get all of that with the bootstrapping?


There already is some basic file I/O in CBQN (though not complete yet). Format parsing isn't hard to do in BQN itself, and finishing the base implementation is a priority over fancy built-in interfaces for now.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: