SkillAgentSearch skills...

Forego

Forth virtual machine in Go

Install / Use

/learn @unixdj/Forego
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

forego - A Forth implementation in Go

Why?

For ego. This is me learning the language. Both of them.

Someone once said that everybody who learns Forth and likes it thinks "oh nice, that'd be cool to write a Forth VM". This happened to me, but I had no actual reason to do it until I started searching for a Go learning project.

And?

Lessons learned: writing a VM without performance constrains or a crude assembler is easy, wrapping your head around multiple run times of Forth compiling words is less so.

So What Is It?

Forego is a naive implementation of a Forth virtual machine in Go that I hacked up in a month or so. Here are its main features and misfeatures:

The Good:

  • The compiler, assembler, parser, main loop and disassembler are now written in Forth. It has (my understanding of) the full CORE wordset and then some, like: .( .r u.r :noname compile, parse parse-name refill source-id to value within
    pick roll ?do again case endcase of endof .s ? dump words ;code ahead bye state /string cmove cmove> sliteral ...and those are written in Forth. Type "words" at the prompt to see the whole list.

The Ambiguous:

  • It has no file support and no interaction with the outside world except key and emit, so untrusted code will have to overflow a buffer in xterm or something to exploit your box.

The Bad:

  • The VM does not resemble real hardware at all.

  • The "kernel" ("machine" code) is hardcoded in the package.

  • It's probably damn slow.

  • The README is incomplete.

View on GitHub
GitHub Stars30
CategoryDevelopment
Updated7mo ago
Forks6

Languages

Go

Security Score

67/100

Audited on Sep 10, 2025

No findings