retroforth/doc/Architecture.md
crc 01c40d9d3d shorter lines in docs
FossilOrigin-Name: a3102b7f4f5bd64f79d0ead274320061feb044e888718ffe45464a52ee4cf612
2017-10-22 18:39:45 +00:00

28 lines
1.2 KiB
Markdown

# Architecture
RETRO has a multilayer design.
At the heart of the system is a virtual machine called Nga. This emulates
a 32-bit stack processor with a MISC based instruction set.
The core RETRO language is stored as a memory image for Nga. The *image
file* contains this and is loaded on startup. It holds all of the compiled
words and data and interacts with Nga.
The third layer is the user interface. RETRO doesn't specify any required
I/O other than a console log capable of receiving a single character at a
time. Each host system can implement this and any additional desired I/O
by extending Nga.
# Specifics
On iOS the user interface is setup around an editor and an output area.
The editor extracts code from fenced regions, splits it into tokens
(elements separated by whitespace) and passes each of these into RETRO
for processing. After the tokens are processed, the console is updated.
The iOS code provides additional I/O functionality. In the `file:`
namespace there are words for creating and using files. There's a
`pb:` vocabulary for interacting with the clipboard. And a `clock:`
namespace which provides access to the system time and date. These
are mapped to higher opcodes outside of the core set used by Nga.