|
|
|
|
|
by Stratoscope
3814 days ago
|
|
That is brilliant! So the embedded FORTH compiler written in AWK reads the FORTH code in a comment like this: //@C SPACES
// \ n --
// BEGIN
// DUP 0>
// WHILE
// SPACE 1-
// REPEAT
// DROP
and compiles it into C code like this (reformatted here to help illustrate): COM(
spaces_word, codeword, "SPACES", &space_word,
(void*)&dup_word, (void*)&more0_word,
(void*)&branch0_word, (void*)(&spaces_word.payload[0] + 8),
(void*)&space_word, (void*)&sub_one_word,
(void*)&branch_word, (void*)(&spaces_word.payload[0] + 0),
(void*)&drop_word,
(void*)&exit_word
)
|
|
It all means that the C source can just be compiled in a single step --- gcc -o fforth fforth.c --- without needing a precompilation stage, which makes it vastly easier to manage.
It's even portable!