aforth

FORTH for Linux x86-64, written in assembly.
git clone git://henryandlizzy.uk/aforth
Log | Files | Refs | README

commit acad3957f2b45ac6c9c4748b10cb73cd93fa5349
parent 7ac00bf7206105dfada68b922a66a9bb429a9db1
Author: Henry Wilson <m3henry@googlemail.com>
Date:   Fri,  4 Aug 2017 18:46:39 +0100

added recursion and examples

Diffstat:
MREADME.md | 19+++++++++++++++++++
Mcompiler.s | 11+++++++++++
Aexample.png | 0
3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -5,3 +5,22 @@ A FORTH written in assembly language for Linux x64 Compiles with GNU Assembler Written by Henry Wilson + + +The process can be run by typing 'make interactive' + +Try entering some of the following: + +10 20 + . + +: STARS 0 DO 42 EMIT LOOP ; +6 STARS + +: TRIANGLE 1+ 1 DO I> STARS CR LOOP ; +4 TRIANGLE + +: TRIANGLE DUP IF DUP STARS CR 1- RECURSE ELSE DROP THEN ; +5 TRIANGLE + +FORGET TRIANGLE +5 TRIANGLE diff --git a/compiler.s b/compiler.s @@ -76,6 +76,8 @@ verb forth compnew "\x3A" #":" const 8 do plus do ALLOT + do HERE + set recurse compile enter endword @@ -93,6 +95,15 @@ verb forth IMMEDIATE do store endword +noverb forth recurse + variable + endword + +verb forth RECURSE "RECURSE" immediate # ( {sys} -- {sys} ) + get recurse + compile + endword + verb forth brackettick "[\x27]" immediate #"'" const ' ' do WORD diff --git a/example.png b/example.png Binary files differ.