Retro is a concatenative, stack based language with roots in Forth.
It is designed to be small, easily learned, and easily modified to meet specific needs, it has been developed and refined through continual use by a small community over the last decade.
This blog is written in Retro and has served as my primary means of posting things concerning Retro since 2010. The core code for Corpse is included in the Retro releases and can be freely studied and deployed.
The most recent posts are shown below. You can also view a list of all posts.
2012-06-18
In Retro, memory is represented as a flat, 32-bit array. In Parable I chose to explore something different.
Memory consists of slices, each of which is a small array. Currently slices are capped at 1,000 cells each, but this is subject to change as continued work refines the needed size range.
A fetch or store operation requires a slice number and an offset. This makes some things slightly harder, but it's pretty easy to simulate Retro-style memory access in many cases.
Parable provides a few functions for working with the memory:
| memory.request | -- ptr | Request a new slice |
| memory.release | ptr -- | Release a slice |
| memory.copy | source-ptr dest-ptr -- | Copy the contents of one slice into another |
| memory.fetch | offset ptr -- value | Fetch a value from a slice |
| memory.store | value offset ptr -- | Store a value into a slice |
For Retro-style variables, evaluate the following:
[ memory.request swap define ] "variable" define [ #0 memory.fetch ] "@" define [ #0 memory.store ] "!" define
With this, you can declare and use variables:
"base" variable #10 &base ! &base @
Other Retro functions like +! can be added easily as well. It's probable that many of these will be available via a standard set of libraries in the future.
I'm not actually sure that there is any significant benefit, apart from being able to release slices once you no longer need them. Perhaps the segmented model will allow me to add a simple garbage collector in the future. For now it's just an interesting experiment.