Forth Machine Design Study: Win4k An interactive forth programming environment with OpenGL bindings

Click to view screenshot

Introduction

Win4K is an interactive forth-based programming environment that comes up with its own console. You can write graphics effects in real-time and modify live variables.

This software was my first attempt to implement a forth machine. Although it has many limitations and bugs, is far away from being complete and currently not in active development stage, I decided to make this tiny computer art available to the public to stress the forth community with new ideas. On this site you'll find some general information on the design issues that made up this machine.

Features

written in ansi c

OpenGL Console

interactive OpenGL programming by redefining the 'render' word

setjmp/longjmp exception handling

Interpreter Design

Virtual Machine Design

Word buffer

Instruction pointer

Data stack

Return stack

Exception stack

typedef void (exec_t) (void*); typedef struct _word word_t; struct _word { exec_t* exec; void* data; };

void code_call (void* wp ); void code_btrue(void* dest ); void code_push (void* imm32 ); void code_ret (void* mark ); void code_imm (void* imm_exec ); void code_throw(void* excid ); void code_exit (void* mark ); void code_dump (void* strptr );

word_t* ip; next: ip->exec(ip->data); ip++; goto next;

Download

Links