Arduino-FVM
Byte Token Threaded Forth Virtual Machine (FVM) for Arduino
Forth.ino File Reference
#include "FVM.h"
Include dependency graph for Forth.ino:

Go to the source code of this file.

Macros

#define THEN_CODE   FORWARD_RESOLVE_CODE
 
#define BEGIN_CODE   BACKWARD_MARK_CODE
 
#define WHILE_CODE   IF_CODE
 

Functions

 FVM_OP (HERE)
 
 FVM_OP (ZERO)
 
 FVM_OP (C_COMMA)
 
 FVM_OP (OVER)
 
 FVM_OP (MINUS)
 
 FVM_OP (SWAP)
 
 FVM_OP (C_STORE)
 
 FVM_OP (COMPILE)
 
 FVM_OP (ZERO_BRANCH)
 
 FVM_CALL (FORWARD_MARK)
 
 FVM_OP (BRANCH)
 
 FVM_CALL (FORWARD_RESOLVE)
 
 FVM_CALL (BACKWARD_RESOLVE)
 
 FVM_CALL (AGAIN)
 
 FVM_OP (DO)
 
 FVM_CALL (BACKWARD_MARK)
 
 FVM_OP (LOOP)
 
 FVM_OP (PLUS_LOOP)
 
 FVM_SYMBOL (15, LEFT_BRACKET,"[")
 
 FVM_SYMBOL (16, COMMENT,"(")
 
 FVM_SYMBOL (17, DOT_QUOTE,".\"")
 
 FVM_SYMBOL (18, LITERAL,"literal")
 
 FVM_SYMBOL (19, SEMICOLON,";")
 
 FVM_SYMBOL (20, RIGHT_BRACKET,"]")
 
 FVM_SYMBOL (21, COLON,":")
 
 FVM_SYMBOL (22, CREATE,"create")
 
 FVM_SYMBOL (23, VARIABLE,"variable")
 
 FVM_SYMBOL (24, CONSTANT,"constant")
 
 FVM_SYMBOL (25, WORDS,"words")
 
 FVM_SYMBOL (26, FORGET,"forget")
 
 FVM_SYMBOL (27, TICK,"\'")
 
void setup ()
 
void loop ()
 
void execute (int op)
 

Variables

const int THEN = 5
 
const char THEN_PSTR [] = "then"
 
const int BEGIN = 7
 
const char BEGIN_PSTR [] = "begin"
 
const int WHILE = 10
 
const char WHILE_PSTR [] = "while"
 
const int DATA_MAX = 32 * 1024
 
const int DICT_MAX = 128
 
uint8_t data [DATA_MAX]
 
FVM fvm (data, DATA_MAX, DICT_MAX)
 
FVM::Task< 64, 32 > task (Serial)
 
int compiling = false
 

Macro Definition Documentation

#define BEGIN_CODE   BACKWARD_MARK_CODE

Definition at line 131 of file Forth.ino.

#define THEN_CODE   FORWARD_RESOLVE_CODE

Definition at line 116 of file Forth.ino.

#define WHILE_CODE   IF_CODE

Definition at line 152 of file Forth.ino.

Function Documentation

void execute ( int  op)

Definition at line 420 of file Forth.ino.

FVM_CALL ( FORWARD_MARK  )
FVM_CALL ( FORWARD_RESOLVE  )
FVM_CALL ( BACKWARD_RESOLVE  )
FVM_CALL ( AGAIN  )
FVM_CALL ( BACKWARD_MARK  )
FVM_OP ( HERE  )
FVM_OP ( ZERO  )
FVM_OP ( C_COMMA  )
FVM_OP ( OVER  )
FVM_OP ( MINUS  )
FVM_OP ( SWAP  )
FVM_OP ( C_STORE  )
FVM_OP ( COMPILE  )
FVM_OP ( ZERO_BRANCH  )
FVM_OP ( BRANCH  )
FVM_OP ( DO  )
FVM_OP ( LOOP  )
FVM_OP ( PLUS_LOOP  )
FVM_SYMBOL ( 15  ,
LEFT_BRACKET  ,
"["   
)
FVM_SYMBOL ( 16  ,
COMMENT   
)
FVM_SYMBOL ( 17  ,
DOT_QUOTE  ,
".\""   
)
FVM_SYMBOL ( 18  ,
LITERAL  ,
"literal"   
)
FVM_SYMBOL ( 19  ,
SEMICOLON  ,
";"   
)
FVM_SYMBOL ( 20  ,
RIGHT_BRACKET  ,
"]"   
)
FVM_SYMBOL ( 21  ,
COLON  ,
":"   
)
FVM_SYMBOL ( 22  ,
CREATE  ,
"create"   
)
FVM_SYMBOL ( 23  ,
VARIABLE  ,
"variable"   
)
FVM_SYMBOL ( 24  ,
CONSTANT  ,
"constant"   
)
FVM_SYMBOL ( 25  ,
WORDS  ,
"words"   
)
FVM_SYMBOL ( 26  ,
FORGET  ,
"forget"   
)
FVM_SYMBOL ( 27  ,
TICK  ,
"\'"   
)
void loop ( )

Definition at line 278 of file Forth.ino.

void setup ( )

Definition at line 271 of file Forth.ino.

Variable Documentation

const int BEGIN = 7

Definition at line 129 of file Forth.ino.

const char BEGIN_PSTR[] = "begin"

Definition at line 130 of file Forth.ino.

int compiling = false

Definition at line 269 of file Forth.ino.

uint8_t data[DATA_MAX]

Definition at line 264 of file Forth.ino.

const int DATA_MAX = 32 * 1024

Definition at line 259 of file Forth.ino.

const int DICT_MAX = 128

Definition at line 260 of file Forth.ino.

FVM::Task<64,32> task(Serial)
const int THEN = 5

Definition at line 114 of file Forth.ino.

const char THEN_PSTR[] = "then"

Definition at line 115 of file Forth.ino.

const int WHILE = 10

Definition at line 150 of file Forth.ino.

const char WHILE_PSTR[] = "while"

Definition at line 151 of file Forth.ino.