a forth for linux x86_64 systems
  • Forth 52.5%
  • nasm 46.9%
  • Makefile 0.6%
Find a file
kitty acd4c35007 jewelforth: version 1
well i guess that's how much i'm gonna get done today.
i may take a lil Break now, (possibly writing Another forth x3)
i've worked on this every day for over a month. which is a lot for me.
seems like a good time to enter Version 1, even though there's
still stuff i wish i got done. i'll get it done maybe probably at some
point.
2026-03-13 20:36:56 +11:00
.gitattributes attempt at correct language detection 2026-01-20 19:28:56 +11:00
.gitignore gitignore, makefile 2026-01-19 23:26:42 +11:00
jefs.fs jewelforth: version 1 2026-03-13 20:36:56 +11:00
jefs.s s= 2026-03-09 02:18:50 +11:00
Makefile rm unnecessary nasm arg 2026-03-08 18:49:04 +11:00
readme.md EXIT (finally) 2026-03-10 02:46:57 +11:00

jewelforth

it's a subroutine threaded forth for linux x86_64. mostly made for personal stuff. it does not conform to any standards, i just implement what i want. if you use it and it breaks, too bad

public domain

dictionary

the dictionary follows a fairly standard format.

field size forth name
link to previous 8 bytes LFA (link field address)
flag 1 byte FFA (flag field address)
string length 2 bytes NFA (name field address)
string variable length still NFA
code variable length CFA (code field address)

non-standard forth

this does not follow any standards. here are some things to keep in mind

  • create can't be used for arrays and stuff. use make instead
  • :noname is called :> (based on duskos). it also just creates a word called _ and pushes its xt to the stack
  • an include discards the rest of the input line
  • exit is immediate (it compiles a ret into the definition)

the one reserved register

the working stack pointer is r14. the other registers are used as general purpose registers; r11 in particular is the standard register used in compiling calls.

error codes

in order to have Good Error Handling anywhere, the error handler's xt is stored in the handler variable and is then called by loading its value and executeing it. the actual description of the error comes from the error variable (in case the stack is fucked)

the error codes are:

  • 1: stack underflow
  • 2: word not found
  • 3: compilation only
  • 4: interpret only
  • 5: includes too recursed

TODO

  • testing
  • more terminal control words
  • s\"
  • DO + LOOP
  • <BUILDS and DOES>
  • better documentation?
  • turnkey executable generation from current dict?