So I failed Sexprs, for now

Posted by s on Dec. 1, 2008, 11:02 p.m.

Implemented a Forthish interpreter. Developing it alongside Forthish assembler. Thus I can test things right away and then try to work out the ASM kinks. Also making some stack macros, here's one that swaps the top two items of the stack

pop eax

push long[esp],eax

Of course that assumes that the items you want swapped are 32bit

So ya, never forget that a stack is really just an array bundled with two crude methods. Else you'll waste precious registers doing

pop eax,ebx

push ebx,eax

So ya, I've got

defun cat 1 2 + ;

cat

3 4 +

Becoming

include 'macro.inc'

section '.text' code readable executable

main:

jmp MAIN

func_99_97_116:

push long 1

push long 2

stackadd

jmp ebp

MAIN:

mov ebp,FCALL69105

jmp func_99_97_116

FCALL69105:

push 3

push 4

stackadd

.end main

Using FASM as a backend. Allows for me convert + to stackadd and program stackadd as a FASM macro. Don't mind the newlines, I'm paranoid. And yes, I have a simple macro system (read parameterless token replace) for people who don't like having a jump for every call (Just an extension of how I'm implementing the +,*,-,/,etc stuff)

And yay for functions not being allowed to call functions

Comments