5 ms·
Unfortunately, LLVM is very heavily oriented toward register machines, so adapting its backends to handle a stack architecture would be quite onerous. There is,
by RodgerTheGreat 13y ago
Unfortunately, LLVM is very heavily oriented toward register machines, so adapting its backends to handle a stack architecture would be quite onerous. There is, however, a forth-like demo language called Stacker[1] which might interest you.
edit: It's also worth noting that .fs (Forth Source) has quite a bit of history as a Forth file extension. Github is of the opinion that this belongs to F#, much to my chagrin.
[1] http://llvm.org/releases/2.0/docs/Stacker.html http://llvm.org/releases/2.0/docs/Stacker.html
- temp453463343 13y agoSounds like Forth would be perfect for the JVM
- swdunlop 13y agoIt would, except that the JVM is short a stack -- Forth really likes having two. A Toy Forth is a great next step after writing a Toy Lisp. It's like exploring an alternate universe, where any sort of abstraction between you and the hardware should be knocked down in the name of simplicity. A few great places to get started: - Forth Warrior, a programming game using a java-based Forth machine with 2d sprites. - Jones Forth, a literate x86 forth implementation (great for learning plumbing) - Retro Forth, a minimalist little virtual machine and Forth image that targets it. None of these are ANS Forth / FIG Forth / etc compatible, which I think is in keeping with Moore's tradition of just whipping up a new dialect whenever he has a new problem domain. [1]: https://github.com/JohnEarnest/Mako/tree/master/games/Warrior2 https://github.com/JohnEarnest/Mako/tree/master/games/Warrio... [2]: http://git.annexia.org/?p=jonesforth.git;a=blob_plain;f=jonesforth.f http://git.annexia.org/?p=jonesforth.git;a=blob_plain;f=jone... [3]: http://retroforth.org http://retroforth.org
- nottwo 13y agoAnother fun toy is Forth Haiku at http://forthsalon.appspot.com/ http://forthsalon.appspot.com/ A Forth Haiku is an attempt to mix mathematics, art, and the Forth programming language. It resembles a texture shader, however, the emphasis is on direct expression in the resulting image. The Forth program describing each Haiku is run once per pixel over a square image. Forth cells are floating point. Conditions return 1 instead of -1. The position is available from the words x and y, which range from 0 to 1, which the origin in the lower left hand corner. The haiku returns the desired color in (red, green, blue, alpha), with alpha being topmost on the stack. If the stack has less than 4 items default values are assumed: red:0, green:0, blue:0, alpha:1. Like a traditional haiku, an ideal Forth Haiku has 3 lines of 5, 7, 5 words. Compositions which don't fit the haiku form are either 'short' (less than 140), or 'long'.