this post was submitted on 20 Dec 2024
5 points (69.2% liked)

Programming

18142 readers
110 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
 

cross-posted from: https://lemmy.ml/post/23785552

After nearly 2 years of work, I'm excited to release the first version of bjForth, featuring partial JONESFORTH compatibility and initial Java interop.

Grab it and start hacking: https://github.com/bahmanm/bjforth/releases/tag/v0.0.2

PS: bjForth is a Forth (indirect threaded) written entirely in Java and its execution model is influenced by that of JONESFORTH.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 month ago (1 children)

Haha...good point! That said bjForth is still a fully indirect threaded Forth. It's just that instead of assembler and C/C++ it calls Java API to do its job.

[–] solrize 2 points 1 month ago (1 children)

Traditionally Forth is implemented completely in Forth. Jonesforth is kind of non-traditional in that sense, because it is in assembler.

[–] [email protected] 2 points 1 month ago (1 children)

That's impossible unless you've got a Forth machine.

Where the OS native API is accessible via C API, you're bound to write, using C/C++/Rust/etc, a small bootstrap programme to then write your Forth on top of. That's essentially what bjForth is at the moment: the bootstrap using JVM native API.

Currently I'm working on a set of libraries to augment the 80-something words bjForth bootstrap provides. These libraries will be, as you suggested, written in Forth not Java because they can tap into the power of JVM via the abstraction API that bootstrap primitives provide.

Hope this makes sense.

[–] solrize 4 points 1 month ago (1 children)

You start with a working Forth and then bootstrap, sort of like writing a C compiler in C. There is an additional trick that Forth calls metacompilation (note, that term has a different meaning outside of the Forth world). See: https://www.bradrodriguez.com/papers/moving4.htm

[–] [email protected] 2 points 1 month ago (1 children)

That's definitely an interesting idea. Thanks for sharing.

Though it means that someone down the line must have written a bootstrap programme with C/Assembler to run the host forth.

In case of jbForth, I decided to write the bootstrap too.

[–] solrize 2 points 1 month ago (1 children)
[–] [email protected] 1 points 1 month ago

Whoa! This is pretty rad! Thanks for sharing!