• bahmanmOP
    link
    fedilink
    21 month ago

    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
      link
      41 month ago

      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

      • bahmanmOP
        link
        fedilink
        21 month ago

        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.