refrences

This commit is contained in:
2026-02-19 16:16:24 -05:00
parent 3ce2977f01
commit 2d43f1711c
90 changed files with 30482 additions and 1 deletions

View File

@@ -0,0 +1,322 @@
# A Forth for x86-64 personal computers
**Source:** https://dacvs.neocities.org/SF/
SmithForth
# A Forth for x86-64 personal computers
```
David Smith 2022 david.a.c.v.smith@gmail.com
```
***New:*** Check out **[Andrei Duma's explanation of SmithForth](https://github.com/AndreiDuma/SmithForth_RISC-V)!** He has implemented in **RISC-V** the machine-code part of SmithForth and more!
* SmithForth runs on Linux x86-64 systems.
* I believe some other Unix x86-64 systems can run Linux ELF binaries. SmithForth should run on these.
* SmithForth should run on your Windows system if you have installed the Windows Subsystem for Linux. I haven't tried it.
## SmithForth design
SmithForth is an implementation of the Forth programming language for x86-64 desktop computers.
SmithForth is a text interpreter that runs in a Linux text console.
You can use SmithForth as you would use any other standard Forth system.
SmithForth follows the [the Forth standard of 2012](https://forth-standard.org/).
The Forth standard describes some optional word sets concerning features like floating-point arithmetic and dynamic memory allocation that most programmers today would regard as standard, but the Forth community considers optional, perhaps because Forth runs on modest machines like microcontrollers.
SmithForth does not yet have floating-point arithmetic, local variables, or file access.
When I consider using a programming environment, I expect it to work on my hardware, and I expect it to be concrete and simple as possible.
Good luck finding tools that meet this standard.
So I wrote SmithForth.
Please take a look at the source code and the comments.
SmithForth is implemented in the subroutine-threaded style, which I think is the most straightforward way.
The [Intel manual](https://software.intel.com/content/www/us/en/develop/articles/intel-sdm.html) is our source of information on the x86 architecture.
We use none of the usual tools from the world of C, not even an assembler.
SmithForth is implemented in two source files:
1. **[SForth.dmp](SForth220711dmp.txt)** contains a primitive Forth system in 1000 hand-written bytes of annotated machine code.
2. **[system.fs](system220711fs.txt)** contains 1000 lines of system Forth to complete a standard Forth system.
## How to run SmithForth
1. ### Combine SForth.dmp and system.fs into one binary file.
Machine code is converted from a human-readable format "DMP" to binary by `xxd`
(hex dump) `-r` (reverse).
```
$ cut -d'#' -f1 SForth.dmp | xxd -p -r > SForth
$ cat system.fs >> SForth
```
The Forth source text is grafted onto the binary.
2. ### Turn the binary file into a proper executable.
Grant permission to execute the file on the Linux system.
```
$ chmod +x SForth
```
You should now have a working executable (if your system is similar enough to mine).
(*Optional:*)
Advanced users might edit the kernel or system.fs.
You must ensure that the ELF segment header entry `p_filesz` contains the number of bytes of the segment that appear in binary file `SForth`.
In my design, that's the whole file, including ELF header, machine code, and system Forth.
We prefer not to count those bytes by hand.
An easy solution is:
1. Make the binary as above. Don't run the binary yet.
2. Ask the system for the size of the binary file.
3. Write the result into field `p_filesz` of `dmqc.dmp`.
4. Remake the binary. The binary is ready to run.
My script [make.sh](make220711sh.txt) does these steps automatically:
```
$ ./make.sh # if and only if you modified SForth.dmp or system.fs
```
3. ### Run the SmithForth executable.
You can use SmithForth interactively, or you can feed your program into the standard input stream.
```
$ ./SForth
$ ./SForth < YourProgram.fs
$ cat YourProgram.fs - | ./SForth
```
The last command allows you to use SmithForth interactively after your programs.
---
## Numbers in machines
If you aren't an experienced programmer, here are some things to know before you read the DMP source file.
### Hexadecimal
Numbers in machine-code listings are often written in hexadecimal,
the base-sixteen number system with numerals 0123456789ABCDEF. In
hexadecimal, the nonnegative integers are:
> 0, 1, 2, ..., 9, A, B, C, D, E, F, 10, 11, ..., 1F, 20, ..., FF, 100, 101, ...
### Bytes
A byte is eight bits. The eight bits of a byte have 28 different states,
but our alphabet has fewer symbols. Instead we write these
states in base sixteen (=24) using a pair of hexadecimal numerals. The
states of a byte are:
> 00, 01, 02, ..., FE, FF.
### Binary
Sometimes we need to convert hexadecimal numbers to and from binary (base 2).
Conveniently, one base is the fourth power of the other, and the conversion
can be done in one-to-four fashion, repeatedly, independently. For example:
> 3E hexadecimal = 0011 1110 binary,
as 3 = 0011 and E = 1110.
You may see bits of a binary number grouped in various ways. For example,
x86 instruction "sub r/m32, r32" has a ModR/M byte written:
> 11 111 000.
Bits 11 select an access mode for argument r/m32, and bits 000 select
register EAX for that argument. The middle three bits 111 select
register EDI. To convert this into hexadecimal, we regroup the eight bits:
> 1111 1000 binary = F8 hexadecimal (as 1111 = F and 1000 = 8).
### Endianness
In hexadecimal, and in our usual decimal system, numbers with more than one
numeral are written with more significant numerals first:
* Decimal has hundreds before tens before ones.
* Hexadecimal has two hundred fifty-sixes before sixteens before ones.
Such systems are *big-endian*. *Little-endian* is the reverse order, with
less significant numerals first.
### The little-endian x86
The x86 architecture is **little-endian in bytes** (that is, little-endian in base 28) ...
> When an integer is moved from a CPU register into memory, for example, the
> least significant byte appears first in memory.
... but each byte is written as a **big-endian pair** of hexadecimal numerals.
This custom is observed:
* in Intel's manuals,
* in the output of tools (like xxd) that convert binary files to text, and
* in the input of tools that convert text (like our DMP file) to binary files.
For example,
* hexadecimal 12 is eighteen,
* hexadecimal 12 00 is eighteen (= 0012 big-endian), and
* hexadecimal 12 00 00 00 is eighteen (= 00000012 big-endian).
### Machine arithmetic is modular
There are infinitely many integers, but digital machines have finitely many states.
Integers processed by the Arithmetic Logic Unit (ALU) of the machine are more aptly
called congruence classes, as the ALU performs modular arithmetic for addition,
subtraction, and multiplication, where the modulus of the congruence relation is a
power of 2, like 28. However, some operations involve a particular representative
of a congruence class.
Two rules are commonly used to select a representative. They are:
1. **unsigned**, where the representatives are
> 0, 1, 2, ..., modulus - 1, and
2. **signed**, where the representatives are
> 0, 1, ..., modulus/2 - 1, (*nonnegative*) and
> -1, -2, ..., modulus/2 (*negative*);
but the machine has no "minus sign," so instead we use
> modulus - 1, modulus - 2, ..., modulus/2 (*negative*).
For example, if the modulus is 28, the signed representatives are
> 00, 01, ..., 7F, (nonnegative)
> FF, FE, ..., 80 (negative).
We can tell negative from nonnegative by the most significant bit.
* Nonnegatives have most significant bit 0.
* Negatives have most significant bit 1.
Watch for "unsigned" and "signed" in the Intel manual.
## Implementing Forth
If you aren't an experienced Forth programmer, here are some things to know before you read the Forth system file.
### Conditionals
Compiling in Forth is simple. The compiler sees a word W, looks it up in the dictionary,
and appends to the body of the current dictionary entry a CALL instruction. The target of
the CALL is the address of the body of the dictionary entry of word W.
CALL facilitates the use of subroutines, which normally return control to the point in the instruction
stream where CALL occurred. There are other forms of flow control, mainly conditionals
and loops.
```
: X ... flag IF ... ( do this if flag is nonzero ) ... THEN ... ;
\ /
-->-- ( skip to THEN if flag is zero ) ---->---
```
Forth has words IF and THEN for conditional execution. They are used in compilation mode.
Normally IF is paired with an instance of THEN later in a word definition.
When the interpreter reaches IF at run time, it examines the number at the top of the stack.
If the number is nonzero, execution continues past IF.
If the number is zero, execution jumps past THEN.
The microprocessor has flow-control features including jumps and conditional jumps.
The Forth compiler, when it sees IF, might emit a conditional jump.
A likely instruction of this kind in x86 is JZ, jump if zero. JZ has a parameter that
indicates where to jump to, *past THEN* in this case. However, when the compiler
first sees IF, it has not yet seen any THEN. So the plan is:
1. Upon IF, reserve space in the compiler's output for instruction JZ and produce (push) a reference.
2. Continue compiling as usual.
3. Upon THEN, consume (pop) a reference and finish formulating instruction JZ.
In the Forth standard, this is *resolving a forward reference*.
Forth implements this plan by using the data stack during compilation:
* IF ( flag -- ) Compilation: ( -- orig ) ... ;
* THEN ( -- ) Compilation: ( orig -- ) ... ;
Stack-effect comments like ( bef -- aft ) describe the end of the stack before and after the word is executed.
The LIFO property of the stack allows IF-THEN statements to be nested.
### Loops
Forth offers several ways to write loops.
One is BEGIN-WHILE-REPEAT.
```
--------------------------------<---------------------------
/ \
: X ... BEGIN ... flag WHILE ... ( do this if flag is nonzero ) ... REPEAT ... ;
\ /
--->-- ( skip to REPEAT if flag is zero ) ---->----
```
* BEGIN ( -- ) Compilation: ( -- dest ) ... ;
* WHILE ( flag -- ) Compilation: ( dest -- orig dest ) ... ;
* REPEAT ( -- ) Compilation: ( orig dest -- )
BEGIN-WHILE-REPEAT is versatile, allowing to exit from the middle of a loop body.
BEGIN-WHILE-REPEAT can emulate other control structures:
IF-THEN:
: flag BEGIN WHILE ... 0 REPEAT
IF-ELSE-THEN:
: flag DUP BEGIN WHILE DROP ... 1 0 REPEAT 0= BEGIN WHILE ... 0 REPEAT
BEGIN-UNTIL:
: BEGIN ... flag 0= WHILE REPEAT
---
## Simpler software
Here are my opinions and motivations for this project.
**Forth** is a simple programming language that achieved some fame back when personal computers were young.
What else would run on such modest computers?
Nowadays computers and languages are fancy and complex.
I say Forth is still a good choice. Forth is simple enough that we may reason about it and understand it.
Forth provides:
* features found in most programming languages:
+ conditionals (if-else)
+ loops
+ variables
+ user-defined functions
* and more:
+ CREATE
+ DOES>
A good system helps us to solve our problems quickly.
Some systems try to be comprehensive.
Others keep it simple.
SmithForth is small and flat enough that a programmer can understand it all.
SmithForth has only a couple files.
We use none of the usual tools from the world of C.
You might argue that C makes programming simpler by insulating us from the workings of the machine.
I might agree if:
* in our daily work, we are allowed to focus on a small number of layers, and
* each layer is well documented,
but this has not been my experience.
C is intentionally vague about the dimensions of machines -- *an irritation the programmer* -- so that programs are portable -- *a feature I never use*.
There is always one kind of machine available, usually x86.
The Intel architecture is fairly well documented, and although the Intel manual is huge, we can find the few parts we need.
For an introduction to x86 machine-language programming (without Forth), please see
[my video series](https://www.youtube.com/playlist?list=PLZCIHSjpQ12woLj0sjsnqDH8yVuXwTy3p) on that topic.
I can imagine a system that contains its own documentation and C source code and tailors these to the computer on which it is installed in such a way that the user can study them and be unconcerned with other computers. No one does this, as far as I know.
Forth has been implemented many times.
Some Forths have a small kernel so that the system can be ported easily to other architectures (by implementing only a small number of kernel words in machine code).
But if you want the system to run well, you have to write more machine code anyway, don't you?
My goal with SmithForth is not to stop writing machine code early, but to start writing Forth early.
In SmithForth, our early Forth contains a lot of machine code.
I believe SmithForth is a good first Forth to learn and a good first programming environment.
The shortened presentation may appeal to mathematicians.
If you want to know my ideas for the direction of this project, I would like to write extensions so that SmithForth becomes
fast and suitable for scientific computing;
and to add enough features of Lisp, Python, Awk, and Tcl that I wouldn't think to use those languages.
I would like to adapt it to other machines and make it usable without an underlying operating system like Linux.

View File

@@ -0,0 +1,380 @@
# Archived Website
**Source:** https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/index.html
```
\\\\\\` \\\\\\\\\\`\\\`\\\\\\\\\`\\\\\\\\\` \```\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\ `\\` ``\`\\\\` `\ \ \\`` `\\\` ``\` ``\`\\\\`\\
`, , o `, ` `
. .oo.. . . o ... ' .o
OO. ...ooOO..... o . ooOOoooo.. . O o . .
OOOo..OOOOOOOo... ....OOo.... .o..... oOOOOOOOOoooo.... Oo. oO
OOOOOOOOOOOOOOO .Ooo. OOOOo......oo. ..ooOO..OOOOOOOOOO......oo.OOo... ..OOO
OOOOO.OOOOOOo.. oOOOOoo. .OO..OOOOOOOOOOOo.......OOO......OOOOOOOOOOoo.OOOOOO
OOOOOo.OOOOOOOoOOOOOOOOOOO.OOOOOOO|OOOOOOOOOO...||||oo.OOOOOOOOOOOoOOOOOooOOO
||oooOOOOOOOOOOOOOOOOOOO|||||ooOOOO|OOOOO|||||oooOOOOOO|OOO|OOOOOOOOOOOOOOOOO
. OOO''||''OOOOOOOOOOOO|||||''||''OO|||o|||||||''||OOOOOO''OOO''OOO|||ooooOO|OO .
O OOO ||..||OO||||||||||OOo || ||||||||||||| ||||OO|| |o| ||||||||OO||OOO O
' o| |''|' '' '|' '| | '| | |||| |' '| | |' '|' 'OO '
||| || | . . | . || || . | | ||/| | . || |oO || ' | |||||
/|| || | | | | | || || | | | |//| | | || ||| || ...||.. '||
//| || | | | | ' || || | | ' |//| | ' || ||| || '''|''' |/
///..//../../../..//.../....//../../... ////..//...///..///..///....//...///
/////////////../////////////.//////////..///////////././///////./////////////
////.//.//. ..//...././/. ///////..//////.///.//.... ././//...//..////////
//.... . ./ /////. ...//. ./////... . ... .. ././/
.. .. . .// . ...
/
```
# 20161121 - Index - [RSS](index.rss)
*TimothyLottes.github.io - Welcome to this Online Blog and Archive.*
[![](20161114-D.bmp)](20161114-D.bmp)
**Recently Changed**
[20161121 - Moving Beyond Rendering With Triangles](20161121.html)
[20161117 - Mechanics of Vulkan SPIR-V Specialization](20161117.html)
[20161114 - Believing in an Image](20161114.html)
[20161113 - Vintage Programming 2](20161113.html)
**Updates**
RSS feed is done manually, so only the minimal note that a page was added.
Switched over to using [protonmail.com](https://protonmail.com/) for my email.
To contact me, email TimothyLottes at that domain.
Using [duckduckgo.com](https://duckduckgo.com/) for search personally,
*added the duckduckgo widget to this site for direct site search, but the site is too new to get picked up yet*.
Slowly migrating everything else to this site,
and attempting to restore what I can from prior lost images.
* 190 pages left to sort through on blogger* 60 docs left to sort through on drive
**2016**
[20161121 - Moving Beyond Rendering With Triangles](20161121.html)
[20161117 - Mechanics of Vulkan SPIR-V Specialization](20161117.html)
[20161114 - Believing in an Image](20161114.html)
[20161113 - Vintage Programming 2](20161113.html)
[20161112 - Plasma Displays](20161112.html)
[20161109 - CreamTracker](20161109.html)
[20161108 - Linux Link Farm](20161108.html)
[20161105 - Owlboy via CRT](20161105.html)
[20161104 - Is OpenVR Actually Open?](20161104.html)
[20161103 - Game List](20161103.html)
[20161102 - Frequent Web Travels](20161102.html)
[20161101 - Linear Dithering Before Transfer Function](20161101.html)
[20161031 - FPGA Links](20161031.html)
[20161030 - Demo Tube Mega List](20161030.html)
[20161029 - Program Per Clock](20161029.html)
[20161028 - Rotated View Vs Rotated Sample Grid In Pixel](20161028.html)
[20161027 - FXAA Pixel Width Contrast Reduction](20161027.html)
[20161023 - Sphere Tracing AA](20161023.html)
[20161022 - Variation on Branching Design - Return Only](20161022.html)
[20161018 - Fixed Point Rounding](20161018.html)
[20161017 - Notes from Attempting to Understand FPGA Timing Limits](20161017.html)
[20161016 - Instruction Fetch Optimization](20161016.html)
[20161015 - Atomic Scatter-Only Gather-Free Machines](20161015.html)
[20161014 - Possible Directional Routing Hoplite Variant?](20161014.html)
[20161013 - SymbOS - 8-bit OS Awesome Sause](20161013.html)
[20161012 - Technical Evaluation of Traditional vs New "HDR" Encoding Crossed With Display Capability](20161012.html)
[20161011 - Forth Hardware Thoughts](20161011.html)
[20161005 - Epiphany-V Taped Out](20161005.html)
[20161004 - T4K Try 3](20161004.html)
[20161003 - T4K Try 2](20161003.html)
[20161001 - T4K Try 1](20161001.html)
[20160921 - Parallel Noise Generation](20160921.html)
[20160912 - The Great MacOS 9](20160912.html)
[20160909 - Thinking "Clearly" About 4K](20160909.html)
[20160908 - Transistor Count Thoughts](20160908.html)
[20160905 - GPU Parking Lot](20160905.html)
[20160806 - Uber Shader Unrolling](20160806.html)
[20160731 - Vulkan From Scratch Part 2](20160731.html)
[20160728 - Blink Mechanic for Fast View Switch for VR](20160728.html)
[20160727 - Vulkan - How to Deal With the Layouts of Presentable Images](20160727.html)
[20160726 - On Killing WIN32?](20160726.html)
[20160724 - Simplified Vulkan Rapid Prototyping](20160724.html)
[20160723 - Why Motion Blur Trivially Breaks Tone-Mapping - Part 2](20160723.html)
[20160721 - Why Motion Blur Trivially Breaks Tone-Mapping - Part 1](20160721.html)
[20160720 - Re Twitter: Thoughts on Vulkan Command Buffers](20160720.html)
[20160715 - LED Displays](20160715.html)
[20160706 - Low Cost Branching to Factoring Out Loop Exit Check](20160706.html)
[20160705 - CPU Threading to Hide Pipelining](20160705.html)
[20160704 - Relative Addressing With XOR - Removing an Adder](20160704.html)
[20160331 - Instant Soft-Reboot to Prior Machine Snapshot](20160331.html)
[20160127 - Temporal AA Neighborhood Clamp](20160127.html)
[20160126 - Local/Global Dimming, Blooming, Contrast Ratios - CRT/LCD/Plasma/OLED](20160126.html)
**2015**
[20151222 - Random Holiday 2015](20151222.html)
[20151123 - Cross-Invocation Data Sharing Portability](20151123.html)
[20151122 - CRT Inventory](20151122.html)
[20151121 - ISA Toolbox](20151121.html)
[20151116 - Mixing Temporal AA and Transparency](20151116.html)
[20151113 - Rethinking the Symbolic Dictionary](20151113.html)
[20151025 - Finer Points of Living in the Raleigh North Carolina Area](20151025.html)
[20151021 - Thoughts on Minimal Filesystem Design](20151021.html)
[20150930 - Tonemapping and Slot Mask Simulation](20150930.html)
[20150915 - Bacon Wrapped Sour Cream](20150915.html)
[20150914 - Tearaway Unfolded PS4 on Wega CRT HDTV](20150914.html)
[20150913 - Minimal Operand CPU ISA For IPC](20150913.html)
[20150912 - Self-Correcting Part 2 or Rather a Rant on Why Extreme DoD](20150912.html)
[20150911 - Self-Correcting CPU Pipelines](20150911.html)
[20150910 - September Trip to Iceland](20150910.html)
[20150829 - Ketogenic Diet Working on Year 2](20150829.html)
[20150828 - Atari Shock Reloaded?](20150828.html)
[20150814 - The Written Word](20150814.html)
[20150810 - 1536-5 : Keys](20150810.html)
[20150809 - 1536-4 : Coloring](20150809.html)
[20150722 - 1536-3 : Simplify, Repeat](20150722.html)
[20150719 - CRT Shadow Masks vs LCD](20150719.html)
[20150718 - Stochastic 1 Sample/Pixel Lit Fog stills](20150718.html)
[20150715 - 1536-2 : Assembling From the Nothing](20150715.html)
[20150714 - 1536-1 : The Programmer Addiction = Feedback](20150714.html)
[20150713 - Great Tube: Old computers did it better!](20150713.html)
[20150712 - Oh How Programming Has Changed](20150712.html)
[20150710 - Inspiration Reboot](20150710.html)
[20150709 - GPU Unchained ASCII Notes](20150709.html)
[20150630 - Sugar Free Peppermint Chocolate Chip Custard Ice Cream](20150630.html)
[20150624 - AMD Fury X (aka Fiji) is a Beast of a GPU Compute Platform](20150624.html)
[20150623 - BenQ XL2730Z Blur Reduction vs CRT](20150623.html)
[20150604 - Panasonic CT-34WX59 = Piece of Junk](20150604.html)
[20150525 - OS Project : 7 - PS/2 and Misc](20150525.html)
[20150522 - The Other Project Cleaned Up](20150522.html)
[20150509 - OS Project : 6 - Hashing](20150509.html)
[20150430 - The Other Project Getting Wired](20150430.html)
[20150426 - Source-Less Programming : 5](20150426.html)
[20150424 - Source-Less Programming : 4](20150424.html)
[20150423 - Source-Less Programming : 3](20150423.html)
[20150422 - Source-Less Programming : 2](20150422.html)
[20150421 - Look No Triangles : Scatter vs Gather](20150421.html)
[20150420 - From Scratch Bug 2 : Source-Less Programming](20150420.html)
[20150416 - Pixel Art and Slot Mask Pitch](20150416.html)
[20150415 - Indie vs Real Slug Fest](20150415.html)
[20150414 - From Scratch Bug](20150414.html)
[20150406 - End of an Era](20150406.html)
[20150403 - Why I'm Using Fedex From Now On](20150403.html)
[20150328 - Stills From My Talk](20150328.html)
[20150309 - Quick Thoughts on Strobbed LCD Displays for VR Perf Proxy](20150309.html)
[20150327 - Other CRT Options](20150327.html)
[20150308 - CRTs](20150308.html)
[20150221 - Great Example of Horrible API Interface Design](20150221.html)
[20150220 - The Order 1886!](20150220.html)
[20150111 - Leaving Something for the Imagination](20150111.html)
**2014**
[20141231 - Continued Notes on Custom Language](20141231.html)
[20141223 - Transparency/OIT Thoughts](20141223.html)
[20141211 - AMD64 Assembly Porting Between Linux and Windows](20141211.html)
[20141010 - The Source of the Strange "Win7" Color Distortion?](20141010.html)
[20141006 - Driving NTSC TV from GTX 880M](20141006.html)
[20140926 - Post Depth Coverage](20140926.html)
[20140921 - Using GDB Without Source and With Runtime Changing of Code](20140921.html)
[20140920 - Interlacing at High Frame Rates and Low Persistence?](20140920.html)
[20140830 - HDFury Nano GX: Part 2](20140830.html)
[20140828 - HDFury Nano GX: HDMI to VGA](20140828.html)
[20140826 - Scifi Reading Suggestion List From Twitters](20140826.html)
[20140823 - MinWM](20140823.html)
[20140819 - Scanlines](20140819.html)
[20140816 - Vintage Programming](20140816.html)
[20140814 - HRAA And Coverage and Related Topics](20140814.html)
[20140810 - Front Buffer Rendering](20140810.html)
[20140809 - Strict Aliasing](20140809.html)
[20140730 - Scanlines and Vintage TVs](20140730.html)
[20140723 - Body Hacking Running on Oil](20140723.html)
[20140717 - Bad Industry Humor: Computer Engineering Hall of Shame](20140717.html)
[20140715 - Infinte Projection Matrix Notes](20140715.html)
[20140712 - VR Topics : Racing Scan-Out + Filtering/Noise](20140712.html)
[20140627 - CG Anti-Aliasing in 1984](20140627.html)
[20140621 - Filtering and Reconstruction : Points and Filtered Raster Without MSAA](20140621.html)
[20140606 - Easy Understanding of Natural Draw Rate Limiters and The Route To Zero Overhead](20140606.html)
[20140506 - The Other Project](20140506.html)
[20140413 - Minimal Single Symbol ELF For Using GL](20140413.html)
[20140328 - Related to Filtering for VR](20140328.html)
[20140110 - Portable Read-Only Thumb Linux](20140110.html)
[20140104 - GL Idea Listing](20140104.html)
[20140103 - Killzone Shadow Fall Multiplayer After 50 Hours](20140103.html)
**2013**
[20131126 - Random Next Generation Notes](20131126.html)
[20130825 - Modern Memory Mapping](20130825.html)
[20130808 - Runtime Recompile Reloaded](20130808.html)
[20130707 - Slab Hash](20130707.html)
[20130524 - AMD GCN GPU Scaling : Tablet To Desktop](20130524.html)
[20130325 - Understanding WIN32 GetRawInputBuffer()](20130325.html)
[20130226 - Shader Aliasing and Small Triangles](20130226.html)
[20130119 - Understanding the Speed of Light of Game Input Latency](20130119.html)
**2012**
[20121229 - Practical Non-Atomic CPU/GPU Communication](20121229.html)
[20121203 - Simple Custom Web Server Tricks](20121203.html)
[20121202 - Winged Doom: Stealer](20121202.html)
[20121001 - Linux Distros and Compression](20121001.html)
[20120903 - Linux Threading Via Syscalls](20120903.html)
[20120802 - DX Camera Motion from Depth](20120802.html)
[20120706 - Exposure Render](20120706.html)
[20120513 - Frame Stutter Reduction Via Time Smoothing](20120513.html)
[20120414 - Engine Scaling on April 2012 GPUs](20120414.html)
[20120211 - Old School: Modems](20120211.html)
**2011**
[20111031 - Exclusive Core Access](20111031.html)
[20110907 - Parallel Programming With Clones](20110907.html)
[20110331 - DX11 Tessellation and Level Building Blocks](20110331.html)
**2010**
[20101005 - MSVC Optimizing Static Constant Data Copy?](20101005.html)
[20101004 - MSVC Optimizing Static Constant Function Tables?](20101004.html)
[20100108 - AntiPlanet2](20100108.html)
[20100105 - Game Engine Architecture](20100105.html)
[20100104 - OnLive Notes](20100104.html)
[20100102 - PC CPU Task Parallelism Limits](20100102.html)
**2009**
[20091229 - DirectCompute 3D Fluid Simulation Tube](20091229.html)
[20090917 - Food-For-Thought Supermarket Aisle](20090917.html)
[20090909 - L1 Misses](20090909.html)
[20090812 - Stochastic Visibility in Distorted Fisheye](20090812.html)
[20090804 - Aras's Compact Normal Storage](20090804.html)
[20090728 - Morphological AA Part II](20090728.html)
[20090714 - Hybrid Cached Raycast and Reproject Raster](20090714.html)
[20090710 - Video of Particles via L-System and Stochastic Visibility](20090710.html)
[20090709 - Stochastic Visibility Update](20090709.html)
[20090708 - GPU Ray Traversal Efficiency](20090708.html)
[20090705 - Odd Transparent Rendering Ideas](20090705.html)
[20090611 - Factoring Out the Job Scheduler](20090611.html)
[20090606 - Thread Scheduling Part 3](20090606.html)
[20090605 - SIMD Binning And Caches](20090605.html)
[20090604 - Thread Scheduling Part 2](20090604.html)
[20090602 - Thread Scheduling Part 1](20090602.html)
[20090519 - GPU REYES](20090519.html)
[20090513 - Gaussian KD Trees](20090513.html)
[20090506 - Electromagnetic Spectrum and Rendering](20090506.html)
[20090505 - Compute Mega Post](20090505.html)
[20090501 - 32bpp HDR Blending Idea](20090501.html)
[20090422 - WFA Image Compression](20090422.html)
[20090407 - DXT Tip](20090407.html)
[20090318 - Reattachable Code](20090318.html)
[20090110 - Hole Filling](20090110.html)
**2008**
[20081218 - Reprojection 2](20081218.html)
[20081216 - Reprojection 0](20081216.html)
[20081209 - Atom Updates](20081209.html)
[20081030 - Parallel Rapid Development Architecture](20081030.html)
[20081020 - Temporal Binned Ring Buffers](20081020.html)
[20081014 - Octahedron Mapping](20081014.html)
[20081010 - Temporal Locality](20081010.html)
[20080918 - General Purpose](20080918.html)
[20080709 - Anti-Aliasing](20080709.html)
[20080704 - Micro Polygons II](20080704.html)
[20080628 - Micro Polygons](20080628.html)
**2007**
[20071126 - Optimization and More](20071126.html)
[20071121 - Deferred Shading III](20071121.html)
[20071116 - Deferred Shading II](20071116.html)
[20071026 - Transform Feedback](20071026.html)
[20071025 - Motion Cards](20071025.html)
[20071024 - Geometry Shader Woes](20071024.html)
[20071018 - Cubemap Concepts](20071018.html)
[20071015 - Drawing in Reverse II](20071015.html)
[20070926 - Drawing in Reverse](20070926.html)
[20070921 - Assembler in Atom4th](20070921.html)
[20070919 - Editor Working](20070919.html)
[20070915 - Building the Chicken Without an Egg](20070915.html)
[20070912 - The Making of a Font](20070912.html)
[20070910 - 2 4th | !2 4th](20070910.html)
[20070822 - New Pipeline Progress](20070822.html)
[20070819 - High Dynamic Range](20070819.html)
[20070818 - Deferred Fractal Environment Shading](20070818.html)
[20070817 - Videos Update](20070817.html)

View File

@@ -0,0 +1,23 @@
# Bootstrap yourself into conviviality by writing your own Forth
**Source:** https://vimeo.com/859408
Bootstrap yourself into conviviality by writing your own Forth
# Verify to continue
To continue, please confirm that you're a human (and not a spambot).
## Checking if the site connection is secure
vimeo.com needs to review the security of your connection before
proceeding.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,291 @@
# Building a tiny FORTH for an Arduino UNO in one week
**Source:** https://www.thanassis.space/miniforth.html
Building a tiny FORTH for an Arduino UNO in one week
Building a tiny FORTH for an Arduino UNO in one week
*(July 2021)*
[![Fork me on GitHub](forkme_right_darkblue_121621.png)](https://github.com/ttsiodras/MiniForth/)
It was raining hard, a week ago.
And what could you possibly do on a rainy Saturday afternoon?
Well... I was inspired by [a series of articles on Hackaday](https://hackaday.com/2017/01/27/forth-the-hackers-language/) to...
*...make a Forth interpreter/compiler from scratch...
...then put it inside a 1.5$ Blue Pill microcontroller...
...then repeatedly squash it until it fits inside an Arduino UNO...
...i.e. inside 2K of RAM!*
I haven't done anything even *remotely* close to this in decades.
I *loved* building it :-)
The rainy afternoon turned into a week-long hackfest *(was looking
forward every day to the post-work FORTH-tinkering in the afternoon...)*
The result: [a tiny, mini-Forth](https://github.com/ttsiodras/MiniForth/). In portable C++ :-)
It has...
* basic arithmetic
* star-slash (double-word accurate muldiv)
* literals
* constants
* variables
* direct memory access
* string printing
* reseting
* comments
* nested DO/LOOP
* comparisons
* nested IF/ELSE/THEN
* ...and of course, functions (Forth words)
Here's a recording of it in action:
...and another one, where a small Forth program blinks the Arduino LED:
# ArduinoSTL and Valgrind / AddressSanitizer checks
I meant it when I said "portable" - the [source code](https://github.com/ttsiodras/MiniForth/)
compiles as-is for both native and Arduino builds.
Another part of my reasoning was that
in addition to targeting multiple platforms (e.g. BluePill and
Arduino) I wanted to be able to use Valgrind and AddressSanitizer
to detect - in the host! - any issues I have with my memory handling.
And just as important, debugging with GDB in the native host is much easier/faster.
Since I had embedded targets in mind, I tried ArduinoSTL - but it was too
wasteful memory-wise. It also made the build process significantly slower.
I therefore built my own [memory pool, as well as list, tuple and string-like C++ templates](https://github.com/ttsiodras/MiniForth/tree/master/src/mini_stl.h). It was a nice challenge, re-inventing a tiny C++ STL...
And I understand STL a lot better now, after building small pieces of it myself :-)
# Simulation / Debugging
I setup simulation via [simavr](https://github.com/buserror/simavr.git).
This tremendously improved my developing speed, since a simulator
spawns and runs much faster than the real board. Due to the code
being portable, debugging took place mostly in the host GDB;
and after Valgrind and AddressSanitizer gave their blessing, I usually
found out that the simulator (and the real board) worked fine as well.
# BluePill vs Arduino UNO
Thanks to ArduinoSTL, I quickly reached the point of running inside the BluePill. The 1.5$ mini-monster has 10 times more SRAM than an Arduino UNO;
so in a couple of days, I had a [working branch](https://github.com/ttsiodras/MiniForth/tree/BluePill-STM32F103C).
![Before the Arduino UNO, I run my mini-FORTH inside the 1.5$ Blue Pill](BluePill.jpg)
*Before the Arduino UNO, I run my mini-FORTH inside the 1.5$ Blue Pill*
But as said above, that wasn't nearly enough to make it work in my
Arduino UNO. That required far more work *(see below)*.
As for the BluePill, I should note that, as in all my other embedded targets,
I prefer a development workflow that is based on normal bootloaders
*(not on programmers)*. I therefore burned the
[stm32duino](https://github.com/rogerclarkmelbourne/STM32duino-bootloader)
bootloader on the BluePill, which allowed me to easily program it
in subsequent iterations via the USB connection (and a simple `make upload`).
The same USB connection would then function as a serial port immediately
afterwards - allowing me to interact with the newly uploaded Forth in the
BluePill.
The screenshot below is from a `tmux`: on the left, the output from `make upload`;
and on the right, I used `picocom` to interact with my mini-Forth
over the serial port:
![Compiling, uploading and testing](itworks.jpg)
*Compiling, uploading and testing*
# Memory - the final frontier
That covered the first two days.
But when I tried compiling for the Arduino UNO, I realised that the ArduinoSTL
was not enough. I run out of memory...
So I built my own [mini-STL](https://github.com/ttsiodras/MiniForth/tree/master/src/mini_stl.h),
and tightly controlled *all* memory utilisation.
I also used macro-magic to move all strings to Flash at compile-time
(see `dprintf` in the code)... And saved memory everywhere I could,
re-using error messages across various operations - and storing the
entire array of native operations in Flash.
Nothing flexes your coding muscles as much as optimising; whether it is
for speed or for space. See the implementation of ".S" for example,
where the (obvious) stack reversal code is also the most wasteful...
Changing it to a slower but memory-preserving algorithm allowed me
to use ".S" even when almost all my memory is full.
# C++ vs C
I know that many developers hate C++. I even wrote a
[blog post](cpp.html) about it.
And I understand why - they see code like this...
```
#include "mini_stl.h"
template<class T>
typename forward_list<T>::box *forward_list<T>::_freeList = NULL;
```
...and they start screaming - "what the hell is that", "incomprehensible
madness", etc.
But there are very important benefits in using C++ - and templates
in particular. You write less code, with no additional run-time or
memory overhead compared to C, and with a lot more compile-time checks
that watch your back (for things that would otherwise blow up in your face).
See my Optional for example, that emulates (badly) the optional
type of Rust/OCaml/F#/Scala/Kotlin etc. It **forces** you to check
your returned error codes:
```
Optional<int> Forth::needs_a_number(const __FlashStringHelper *msg)
{
if (_stack.empty())
return error(emptyMsgFlash, msg);
auto topVal = *_stack.begin();
if (topVal._kind == StackNode::LIT)
return topVal._u.intVal;
else
return FAILURE;
}
```
You can't "forget" to check the potential for a failure coded inside
your returned value - because your code has to "unwrap" it. I could have
done this better, but I chose to implement it via simple tuples
(this was a one-weeks-afternoons hack, after all :-)
As for the template "magic" incantation above - it *is* true magic: My
`forward_list` template is using free-lists to store the `pop_front`-ed
elements and reuse them in subsequent allocations. I wanted these free-lists to
be global (i.e. static members) because lists of the same type must re-use a
single, commonly-shared free-list. The magic spell tells the compiler I want to
instantiate these globals *once*, for each type T that I use in any
lists in my code.
# My Forth test scenario - including a FizzBuzz!
Yep, FizzBuzz - we are fully Turing complete. And would surely pass
Joel's interview :-)
```
." Reset... " RESET
." Check comments... " \ Yes, we support the new-style comments :-)
." Computing simple addition of 3 + 4... " 3 4 + .
." Is 1 = 2 ?... " 1 2 = .
." Is 1 > 2 ?... " 1 2 > .
." Is 1 < 2 ?... " 1 2 < .
." Define pi at double-word precision... " : pi 355 113 */ ;
." Use definition to compute 10K times PI... " 10000 pi .
." Check: 23 mod 7... " 23 7 MOD .
." Defining 1st level function1... " : x2 2 * ;
." Defining 1st level function2... " : p4 4 + ;
." 2nd level word using both - must print 24... " 10 x2 p4 .
." Defining a variable with value 123... " 123 variable ot3
." Printing variable's value... " ot3 @ .
." Defining The Constant (TM)... " 42 constant lifeUniverse
." Printing The Constant (TM)... " lifeUniverse .
." Setting the variable to The Constant (TM)... " lifeUniverse ot3 !
." Printing variable's value... " ot3 @ .
." Setting the variable to hex 0x11... " $11 ot3 !
." Printing variable's value... " ot3 @ .
." Defining helper... " : p5 5 U.R . ;
." Defining 3 times loop... " : x3lp 3 0 DO I p5 LOOP ;
." Calling loop... " x3lp
." Defining loop calling loop 2 times... " : x6lp 2 0 DO x3lp LOOP ;
." Nested-looping 2x3 times... " x6lp
." Inline: " : m 3 1 DO 3 1 DO CR J p5 I p5 ." = " J I * p5 LOOP LOOP ;
." Use inline loops with two indexes... " m
." Make multiples of 7 via DUP... " : m7s 10 0 DO DUP I * . LOOP DROP ;
." Print them and DROP the 7... " 7 m7s
." Reset... " RESET
\ Time for Turing completeness...
." Let's do Fizz-Buzz! " \ Turing Completeness check...
\ fizz ( n -- 0_or_1 n )
." Define fizz... " : fizz DUP 3 MOD 0 = IF ." fizz " 1 ELSE 0 THEN SWAP ;
\ buzz ( n -- 0_or_1 n )
." Define buzz... " : buzz DUP 5 MOD 0 = IF ." buzz " 1 ELSE 0 THEN SWAP ;
\ emitNum ( 0_or_1 0_or_1 n -- )
." Define emitNum... " : emitNum ROT ROT + 0 = if . ELSE DROP THEN ;
\ mainloop ( n -- )
." Define mainloop... " : mainloop fizz buzz emitNum ;
\ fb ( -- )
." Define fizzbuzz... " : fb 37 1 DO I mainloop LOOP ;
." Run it! " fb
." Report memory usage... " .S
```
# Automation
I am a strong believer in automation. The final form of my `Makefile`
therefore has many rules - e.g. `make arduino-sim` - that automate
various parts of the workflow.
Here's what they do:
* **arduino**: Compiles the code for Arduino UNO - builds `src/tmp/myforth.ino.{elf,hex}`
* **arduino-sim**: After building, launches the compiled mini-Forth in `simduino`.
* **upload**: After building, uploads to an Arduino attached to the port
configured inside `config.mk`.
* **terminal**: After uploading, launches a `picocom` terminal with
all appropriate settings to interact with my Forth.
* **x86**: Builds for x86. Actually, should easily build for any native target (ARM, etc).
* **test-address-sanitizer**: Uses the x86 binary to test the code, executing
all steps of the scenario shown above. The binary is built with the
address sanitizer enabled (to detect memory issues).
* **test-valgrind**: Same, but with Valgrind.
* **test-simulator**: Spawns `simavr` and sends the entire test scenario shown
above to it - while showing the responses received from it.
* **test-arduino**: Sends the entire test scenario shown above to an
Arduino Uno connected to the port specified in `config.mk`
and shows the responses received over that serial port.
Another example of automation - the complete test scenario shown in the
previous section, is not just an example in the documentation; it is
extracted automatically from this text and fed into the Valgrind and
AddressSanitizer tests... and also into the Python testing script that
sends the data to the board in real-time.
[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), folks.
# Conclusion
I thoroughly enjoyed building this. I know full well that Forths are not
supposed to be built in C++; they are supposed to be built in assembly,
and also, utilise the Flash to store the user-compiled code at run-time.
But that wasn't the point of this - the point was to have fun and learn Forth.
What better way to learn a language... than to actually implement it! :-)
And... as a child of the 80s... I now know first-hand what
[Jupiter Ace](https://en.wikipedia.org/wiki/Jupiter_Ace) was about :-)
Fork the code, and enjoy tinkering with it!
---
[![profile for ttsiodras at Stack Overflow, Q&A for professional and enthusiast programmers](382050.png "profile for ttsiodras at Stack Overflow, Q&A for professional and enthusiast programmers")](https://stackoverflow.com/users/382050/ttsiodras)
[![GitHub member ttsiodras](github.png "GitHub member ttsiodras")](https://github.com/ttsiodras)
| | | |
| --- | --- | --- |
| [Index](index.html) | [CV](cv.pdf) | *Updated: Sun Nov 19 23:06:10 2023* |

View File

@@ -0,0 +1,17 @@
# C2-Wiki: Chuck Moore
**Source:** https://wiki.c2.com/?ChuckMoore
**notice**
javascript required to view this site
**why**
measured improvement in server performance
awesome incremental search
![](spin.gif)
This site uses features not available in older browsers.

View File

@@ -0,0 +1,17 @@
# C2-Wiki: colorFORTH
**Source:** https://wiki.c2.com/?ColorForth
**notice**
javascript required to view this site
**why**
measured improvement in server performance
awesome incremental search
![](spin.gif)
This site uses features not available in older browsers.

View File

@@ -0,0 +1,422 @@
# Callisto
**Source:** https://github.com/callisto-lang/compiler
GitHub - callisto-lang/compiler: The Callisto compiler of the 13th month, and other language extras
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fcallisto-lang%2Fcompiler)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fcallisto-lang%2Fcompiler)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=callisto-lang%2Fcompiler)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[callisto-lang](/callisto-lang)
/
**[compiler](/callisto-lang/compiler)**
Public
* [Notifications](/login?return_to=%2Fcallisto-lang%2Fcompiler) You must be signed in to change notification settings
* [Fork
8](/login?return_to=%2Fcallisto-lang%2Fcompiler)
* [Star
76](/login?return_to=%2Fcallisto-lang%2Fcompiler)
The Callisto compiler of the 13th month, and other language extras
[callisto.mesyeti.uk](https://callisto.mesyeti.uk "https://callisto.mesyeti.uk")
### License
[MIT license](/callisto-lang/compiler/blob/main/LICENSE)
[76
stars](/callisto-lang/compiler/stargazers) [8
forks](/callisto-lang/compiler/forks) [Branches](/callisto-lang/compiler/branches) [Tags](/callisto-lang/compiler/tags) [Activity](/callisto-lang/compiler/activity)
[Star](/login?return_to=%2Fcallisto-lang%2Fcompiler)
[Notifications](/login?return_to=%2Fcallisto-lang%2Fcompiler) You must be signed in to change notification settings
* [Code](/callisto-lang/compiler)
* [Issues
0](/callisto-lang/compiler/issues)
* [Pull requests
0](/callisto-lang/compiler/pulls)
* [Actions](/callisto-lang/compiler/actions)
* [Projects
0](/callisto-lang/compiler/projects)
* [Security
0](/callisto-lang/compiler/security)
* [Insights](/callisto-lang/compiler/pulse)
Additional navigation options
* [Code](/callisto-lang/compiler)
* [Issues](/callisto-lang/compiler/issues)
* [Pull requests](/callisto-lang/compiler/pulls)
* [Actions](/callisto-lang/compiler/actions)
* [Projects](/callisto-lang/compiler/projects)
* [Security](/callisto-lang/compiler/security)
* [Insights](/callisto-lang/compiler/pulse)
# callisto-lang/compiler
main
[Branches](/callisto-lang/compiler/branches)[Tags](/callisto-lang/compiler/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[474 Commits](/callisto-lang/compiler/commits/main/) 474 Commits | | |
| [.gitub-temp-disabled/workflows](/callisto-lang/compiler/tree/main/.gitub-temp-disabled/workflows "This path skips through empty directories") | | [.gitub-temp-disabled/workflows](/callisto-lang/compiler/tree/main/.gitub-temp-disabled/workflows "This path skips through empty directories") | | |
| [docs](/callisto-lang/compiler/tree/main/docs "docs") | | [docs](/callisto-lang/compiler/tree/main/docs "docs") | | |
| [editors](/callisto-lang/compiler/tree/main/editors "editors") | | [editors](/callisto-lang/compiler/tree/main/editors "editors") | | |
| [examples](/callisto-lang/compiler/tree/main/examples "examples") | | [examples](/callisto-lang/compiler/tree/main/examples "examples") | | |
| [source](/callisto-lang/compiler/tree/main/source "source") | | [source](/callisto-lang/compiler/tree/main/source "source") | | |
| [std @ 4c0918c](/callisto-lang/std/tree/4c0918cfa12a9b80f65732b044a0a0c11365204e "std") | | [std @ 4c0918c](/callisto-lang/std/tree/4c0918cfa12a9b80f65732b044a0a0c11365204e "std") | | |
| [.gitattributes](/callisto-lang/compiler/blob/main/.gitattributes ".gitattributes") | | [.gitattributes](/callisto-lang/compiler/blob/main/.gitattributes ".gitattributes") | | |
| [.gitignore](/callisto-lang/compiler/blob/main/.gitignore ".gitignore") | | [.gitignore](/callisto-lang/compiler/blob/main/.gitignore ".gitignore") | | |
| [.gitmodules](/callisto-lang/compiler/blob/main/.gitmodules ".gitmodules") | | [.gitmodules](/callisto-lang/compiler/blob/main/.gitmodules ".gitmodules") | | |
| [LICENSE](/callisto-lang/compiler/blob/main/LICENSE "LICENSE") | | [LICENSE](/callisto-lang/compiler/blob/main/LICENSE "LICENSE") | | |
| [README.md](/callisto-lang/compiler/blob/main/README.md "README.md") | | [README.md](/callisto-lang/compiler/blob/main/README.md "README.md") | | |
| [STYLE.md](/callisto-lang/compiler/blob/main/STYLE.md "STYLE.md") | | [STYLE.md](/callisto-lang/compiler/blob/main/STYLE.md "STYLE.md") | | |
| [TODO.md](/callisto-lang/compiler/blob/main/TODO.md "TODO.md") | | [TODO.md](/callisto-lang/compiler/blob/main/TODO.md "TODO.md") | | |
| [dub.json](/callisto-lang/compiler/blob/main/dub.json "dub.json") | | [dub.json](/callisto-lang/compiler/blob/main/dub.json "dub.json") | | |
| [flake.nix](/callisto-lang/compiler/blob/main/flake.nix "flake.nix") | | [flake.nix](/callisto-lang/compiler/blob/main/flake.nix "flake.nix") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [MIT license](#)
[![](https://camo.githubusercontent.com/4bdb739c0513e67abf8868948c01b60d12189f18d85f06ebb6abd6cf6e156804/68747470733a2f2f63616c6c6973746f2e6d6573796574692e756b2f6c6f676f5f736861646f772e706e67)](https://camo.githubusercontent.com/4bdb739c0513e67abf8868948c01b60d12189f18d85f06ebb6abd6cf6e156804/68747470733a2f2f63616c6c6973746f2e6d6573796574692e756b2f6c6f676f5f736861646f772e706e67)
# The Callisto Programming Language
[Website](https://callisto.mesyeti.uk/) |
[Docs](https://callisto.mesyeti.uk/docs) |
[Awesome List](https://github.com/callisto-lang/awesome-callisto) |
[Discord](https://discord.com/invite/QHAtc4GWq7)
**Callisto** is a stack-based imperative programming language with stack safety enforced
by the compiler (which is optional).
It also has a subset called CallistoScript made to compile to scripting languages like
Lua, while keeping its low level features (like direct access to memory).
## Supported targets
* x86 real mode - MS-DOS, bare metal
* x86\_64 - Linux, macOS, FreeBSD (partial)
* ARM64 - Linux, macOS
* Uxn - Varvara
* Lua
## Build
```
dub build --compiler=ldc
```
The compiler executable will be called `cac`
Warning
Compilation may freeze due to a bug in the Digital Mars D compiler. If this happens,
compile with this command: `dub build --compiler=ldc`.
If that doesn't work, then run with `--compiler=ldc2` instead.
## Run example programs
Make sure you get the standard library
```
git submodule update --remote
```
Then compile example programs like this
```
cac examples/exampleNameHere.cal -i std
```
The output executable will be called `out`. Any example programs that require extra flags
for compilation will have a compile command in a comment at the top of the source file.
## IRC Channel
Join `#callisto-lang` on irc.libera.chat.
## About
The Callisto compiler of the 13th month, and other language extras
[callisto.mesyeti.uk](https://callisto.mesyeti.uk "https://callisto.mesyeti.uk")
### Topics
[programming-language](/topics/programming-language "Topic: programming-language")
[compiler](/topics/compiler "Topic: compiler")
[x86-64](/topics/x86-64 "Topic: x86-64")
[concatenative](/topics/concatenative "Topic: concatenative")
[concatenative-language](/topics/concatenative-language "Topic: concatenative-language")
[concatenative-programming-language](/topics/concatenative-programming-language "Topic: concatenative-programming-language")
[uxn](/topics/uxn "Topic: uxn")
[uxntal](/topics/uxntal "Topic: uxntal")
### Resources
[Readme](#readme-ov-file)
### License
[MIT license](#MIT-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/callisto-lang/compiler/activity)
[Custom properties](/callisto-lang/compiler/custom-properties)
### Stars
[**76**
stars](/callisto-lang/compiler/stargazers)
### Watchers
[**1**
watching](/callisto-lang/compiler/watchers)
### Forks
[**8**
forks](/callisto-lang/compiler/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fcallisto-lang%2Fcompiler&report=callisto-lang+%28user%29)
## [Releases 23](/callisto-lang/compiler/releases)
[Beta 0.13.0 - Modules part 1
Latest
Nov 15, 2025](/callisto-lang/compiler/releases/tag/b0.13.0)
[+ 22 releases](/callisto-lang/compiler/releases)
## [Packages 0](/orgs/callisto-lang/packages?repo_name=compiler)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## [Contributors 7](/callisto-lang/compiler/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [D
99.6%](/callisto-lang/compiler/search?l=d)
* [Nix
0.4%](/callisto-lang/compiler/search?l=nix)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,98 @@
# Cognate
**Source:** https://cognate-lang.github.io
Cognate: Readable and concise concatenative programming
# Cognate
## Readable and concise concatenative programming
```
~~ Fizzbuzz in Cognate
Def Fizzbuzz (
Let N be Of (Integer?);
Def Multiple as (Zero? Modulo Swap N);
If Multiple of 15 then "fizzbuzz"
If Multiple of 3 then "fizz"
If Multiple of 5 then "buzz"
else N
);
For each in Range 1 to 100 (Print Fizzbuzz);
```
Cognate is a project aiming to create a human readable programming language with as little syntax as possible. Where natural language programming usually uses many complex syntax rules, instead Cognate takes them away. What it adds is simple, a way to embed comments into statements.
```
~~ Towers of Hanoi in Cognate
Def Move discs as (
Let N be number of discs;
Let A be first rod;
Let B be second rod;
Let C be third rod;
Unless Zero? N (
Move - 1 N discs from A via C to B;
Prints ("Move disc " N " from " A " to " C);
Move - 1 N discs from B via A to C;
)
);
Move 5 discs from "a" via "b" to "c";
```
As you can see, Cognate ignores words starting with lowercase letters, allowing them to be used to describe functionality and enhance readability. This makes Cognate codebases intuitive and maintainable.
```
~~ Square numbers in Cognate
Def Square as (* Twin);
Map (Square) over Range 1 to 10;
Print;
```
Cognate is a stack-oriented programming language similar to Forth or Factor, except statements are evaluated right to left. This gives the expressiveness of concatenative programming as well as the readability of prefix notation. Statements can be delimited at arbitrary points, allowing them to read as sentences would in English.
```
~~ Prime numbers in Cognate
Def Factor (Zero? Modulo Swap);
Def Primes (
Fold (
Let I be our potential prime;
Let Primes are the found primes;
Let To-check be Take-while (<= Sqrt I) Primes;
When None (Factor of I) To-check
(Append List (I)) to Primes;
) from List () over Range from 2
);
Print Primes up to 1000;
```
Cognate borrows from other concatenative languages, but also adds unique features of its own.
* Point-free functions
* Operation chaining
* Multiple return values
* Combinator oriented programming
* Predicate pattern matching
* Natural language programming
Interested? Read the [tutorial](/learn/), and check out one of Cognates implementations:
* [CognaC](https://github.com/cognate-lang/cognate) is the original compiler it performs type inference and produces efficient binaries.
* [Cognate Playground](https://cognate-playground.hedy.dev/) (developed by [hedyhli](https://github.com/hedyhli)) runs Cognate programs in a web browser.
* [Cogni](https://github.com/dragoncoder047/cogni) (developed by [dragoncoder047](https://github.com/dragoncoder047)) interprets Cognate programs and is optimised to run on microcontrollers.

View File

@@ -0,0 +1,389 @@
# Color
**Source:** https://github.com/AshleyF/Color/tree/master
GitHub - AshleyF/Color: Fun playing around with colorForth and GreenArrays architecture.
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FAshleyF%2FColor%2Ftree%2Fmaster)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FAshleyF%2FColor%2Ftree%2Fmaster)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=AshleyF%2FColor)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[AshleyF](/AshleyF)
/
**[Color](/AshleyF/Color)**
Public
* [Notifications](/login?return_to=%2FAshleyF%2FColor) You must be signed in to change notification settings
* [Fork
22](/login?return_to=%2FAshleyF%2FColor)
* [Star
135](/login?return_to=%2FAshleyF%2FColor)
Fun playing around with colorForth and GreenArrays architecture.
### License
[Unlicense license](/AshleyF/Color/blob/master/LICENSE)
[135
stars](/AshleyF/Color/stargazers) [22
forks](/AshleyF/Color/forks) [Branches](/AshleyF/Color/branches) [Tags](/AshleyF/Color/tags) [Activity](/AshleyF/Color/activity)
[Star](/login?return_to=%2FAshleyF%2FColor)
[Notifications](/login?return_to=%2FAshleyF%2FColor) You must be signed in to change notification settings
* [Code](/AshleyF/Color)
* [Issues
0](/AshleyF/Color/issues)
* [Pull requests
0](/AshleyF/Color/pulls)
* [Actions](/AshleyF/Color/actions)
* [Projects
0](/AshleyF/Color/projects)
* [Wiki](/AshleyF/Color/wiki)
* [Security
0](/AshleyF/Color/security)
* [Insights](/AshleyF/Color/pulse)
Additional navigation options
* [Code](/AshleyF/Color)
* [Issues](/AshleyF/Color/issues)
* [Pull requests](/AshleyF/Color/pulls)
* [Actions](/AshleyF/Color/actions)
* [Projects](/AshleyF/Color/projects)
* [Wiki](/AshleyF/Color/wiki)
* [Security](/AshleyF/Color/security)
* [Insights](/AshleyF/Color/pulse)
# AshleyF/Color
master
[Branches](/AshleyF/Color/branches)[Tags](/AshleyF/Color/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[67 Commits](/AshleyF/Color/commits/master/) 67 Commits | | |
| [Assembler](/AshleyF/Color/tree/master/Assembler "Assembler") | | [Assembler](/AshleyF/Color/tree/master/Assembler "Assembler") | | |
| [Blocks](/AshleyF/Color/tree/master/Blocks "Blocks") | | [Blocks](/AshleyF/Color/tree/master/Blocks "Blocks") | | |
| [Docs](/AshleyF/Color/tree/master/Docs "Docs") | | [Docs](/AshleyF/Color/tree/master/Docs "Docs") | | |
| [Editor](/AshleyF/Color/tree/master/Editor "Editor") | | [Editor](/AshleyF/Color/tree/master/Editor "Editor") | | |
| [Machine](/AshleyF/Color/tree/master/Machine "Machine") | | [Machine](/AshleyF/Color/tree/master/Machine "Machine") | | |
| [Synthesis](/AshleyF/Color/tree/master/Synthesis "Synthesis") | | [Synthesis](/AshleyF/Color/tree/master/Synthesis "Synthesis") | | |
| [Utility](/AshleyF/Color/tree/master/Utility "Utility") | | [Utility](/AshleyF/Color/tree/master/Utility "Utility") | | |
| [.gitignore](/AshleyF/Color/blob/master/.gitignore ".gitignore") | | [.gitignore](/AshleyF/Color/blob/master/.gitignore ".gitignore") | | |
| [Color.sln](/AshleyF/Color/blob/master/Color.sln "Color.sln") | | [Color.sln](/AshleyF/Color/blob/master/Color.sln "Color.sln") | | |
| [LICENSE](/AshleyF/Color/blob/master/LICENSE "LICENSE") | | [LICENSE](/AshleyF/Color/blob/master/LICENSE "LICENSE") | | |
| [README.md](/AshleyF/Color/blob/master/README.md "README.md") | | [README.md](/AshleyF/Color/blob/master/README.md "README.md") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [Unlicense license](#)
# Color
Having fun playing around with [colorForth](http://www.colorforth.com/cf.htm) and [GreenArrays](http://www.greenarraychips.com/) architecture. See the [demo](https://youtu.be/LYtQMmvgg6w) presented to the [Forth2020 Group](http://www.forth2020.org/) in AUG 2021 and [~~blog series~~](http://blogs.msdn.com/b/ashleyf/archive/tags/color/) - Blog series moved here to Github:
* [Chuck Moore's Creations](/AshleyF/Color/blob/master/Docs/chuck_moores_creations.md)
* [Programming the F18](/AshleyF/Color/blob/master/Docs/programming_the_f18.md)
* [Beautiful Simplicity of colorForth](/AshleyF/Color/blob/master/Docs/beautiful_simplicity.md)
* [Multiply-step Instruction](/AshleyF/Color/blob/master/Docs/multiply_step.md)
* [Simple Variables](/AshleyF/Color/blob/master/Docs/simple_variables.md)
[![Editor/Assembler](/AshleyF/Color/raw/master/Docs/images/editor_assembler.png)](/AshleyF/Color/blob/master/Docs/images/editor_assembler.png)
The assembler watches for changes to the block files saved by the editor. I leave an instance of this running in one terminal window (right) while working in the editor in another (left). Later I run the machine in a third window.
## Setup
Everything is written in F# and uses solution (`.sln`) and project (`.fsproj`) files compatible with Visual Studio or `dotnet build`. I personally have been using plain Vim (with the [excellent F# bindings](https://github.com/fsharp/fsharpbinding)). Here's setup steps for Ubuntu:
**Install .NET Core**
* Install the [.NET SDK](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu). For example, for *Ubuntu 21.04* in particular:
```
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-5.0
```
**Pull down the project**
```
git clone http://github.com/AshleyF/Color
```
**Build**
```
dotnet build Color.sln
```
Each project produces an executable (`Assembler.exe`, `Editor.exe`, `Machine.exe`) within `bin/`
**Play!**
The editor edits block files (`/Blocks/*.blk`) while the assembler waits for changes to blocks and assembles them (to block 0). Running the machine executes block 0.
The normal way of working is to run the `./Editor` and `./Assembler` at the same time (in separate tabs or tmux splits, etc.). Each time a block is saved (by pressing `s` in the editor), it's assembled. Then run the `./Machine` to try it out.
## About
Fun playing around with colorForth and GreenArrays architecture.
### Resources
[Readme](#readme-ov-file)
### License
[Unlicense license](#Unlicense-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/AshleyF/Color/activity)
### Stars
[**135**
stars](/AshleyF/Color/stargazers)
### Watchers
[**8**
watching](/AshleyF/Color/watchers)
### Forks
[**22**
forks](/AshleyF/Color/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2FAshleyF%2FColor&report=AshleyF+%28user%29)
## [Releases](/AshleyF/Color/releases)
No releases published
## [Packages 0](/users/AshleyF/packages?repo_name=Color)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## [Contributors 2](/AshleyF/Color/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [F#
100.0%](/AshleyF/Color/search?l=f%23)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,185 @@
# Concatenative language
**Source:** https://concatenative.org/wiki/view/Concatenative%20language
Concatenative language
![](data:image/svg+xml;utf8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 xmlns:xlink=%27http://www.w3.org/1999/xlink%27 width=%2724%27 height=%2716%27 viewBox=%270 0 120 100%27 fill=%27rgb(0,0,0)%27%3E%3Crect y=%270%27 width=%27120%27 height=%2720%27 rx=%2710%27 /%3E%3Crect y=%2740%27 width=%27120%27 height=%2720%27 rx=%2710%27 /%3E%3Crect y=%2780%27 width=%27120%27 height=%2720%27 rx=%2710%27 /%3E%3C/svg%3E)
[Front Page](https://concatenative.org/wiki/)
[All Articles](https://concatenative.org/wiki/articles)
[Recent Changes](https://concatenative.org/wiki/changes)
[Random Article](https://concatenative.org/wiki/random)
## [Contents](https://concatenative.org/wiki/view/Contents)
[Concatenative language](https://concatenative.org/wiki/view/Concatenative%20language)
* [ACL](https://concatenative.org/wiki/view/ACL)
* [Ait](https://concatenative.org/wiki/view/Ait)
* [Aocla](https://concatenative.org/wiki/view/Aocla)
* [Breeze](https://concatenative.org/wiki/view/Breeze)
* [Callisto](https://concatenative.org/wiki/view/Callisto)
* [Cat](https://concatenative.org/wiki/view/Cat)
* [Cognate](https://concatenative.org/wiki/view/Cognate)
* [colorForth](https://concatenative.org/wiki/view/colorForth)
* [Concata](https://concatenative.org/wiki/view/Concata)
* [CoSy](https://concatenative.org/wiki/view/CoSy)
* [Deque](https://concatenative.org/wiki/view/Deque)
* [DSSP](https://concatenative.org/wiki/view/DSSP)
* [dt](https://concatenative.org/wiki/view/dt)
* [Elymas](https://concatenative.org/wiki/view/Elymas)
* [Enchilada](https://concatenative.org/wiki/view/Enchilada)
* [ERIShell](https://concatenative.org/wiki/view/ERIShell)
* [ETAC](https://concatenative.org/wiki/view/ETAC)
* [F](https://concatenative.org/wiki/view/F)
* [Factor](https://concatenative.org/wiki/view/Factor)
* [Fiveth](https://concatenative.org/wiki/view/Fiveth)
* [Forth](https://concatenative.org/wiki/view/Forth)
* [Fourth](https://concatenative.org/wiki/view/Fourth)
* [Freelang](https://concatenative.org/wiki/view/Freelang)
* [Gershwin](https://concatenative.org/wiki/view/Gershwin)
* [hex](https://concatenative.org/wiki/view/hex)
* [iNet](https://concatenative.org/wiki/view/iNet)
* [Joy](https://concatenative.org/wiki/view/Joy)
* [Joy of Postfix](https://concatenative.org/wiki/view/Joy%20of%20Postfix) *App*
* [kcats](https://concatenative.org/wiki/view/kcats)
* [Kitten](https://concatenative.org/wiki/view/Kitten)
* [lang5](https://concatenative.org/wiki/view/lang5)
* [Listack](https://concatenative.org/wiki/view/Listack)
* [LSE64](https://concatenative.org/wiki/view/LSE64)
* [Lviv](https://concatenative.org/wiki/view/Lviv)
* [Meow5](https://concatenative.org/wiki/view/Meow5)
* [min](https://concatenative.org/wiki/view/min)
* [Mirth](https://concatenative.org/wiki/view/Mirth)
* [mjoy](https://concatenative.org/wiki/view/mjoy)
* [Mlatu](https://concatenative.org/wiki/view/Mlatu)
* [Ode](https://concatenative.org/wiki/view/Ode)
* [OForth](https://concatenative.org/wiki/view/OForth)
* [Om](https://concatenative.org/wiki/view/Om)
* [Onion](https://concatenative.org/wiki/view/Onion)
* [Onyx](https://concatenative.org/wiki/view/Onyx)
* [Plorth](https://concatenative.org/wiki/view/Plorth)
* [Popr](https://concatenative.org/wiki/view/Popr)
* [Porth](https://concatenative.org/wiki/view/Porth)
* [PostScript](https://concatenative.org/wiki/view/PostScript)
* [Prowl](https://concatenative.org/wiki/view/Prowl)
* [Quackery](https://concatenative.org/wiki/view/Quackery)
* [Quadrate](https://concatenative.org/wiki/view/Quadrate)
* [Quest32](https://concatenative.org/wiki/view/Quest32)
* [r3](https://concatenative.org/wiki/view/r3)
* [Raven](https://concatenative.org/wiki/view/Raven)
* [Retro](https://concatenative.org/wiki/view/Retro)
* [RPL](https://concatenative.org/wiki/view/RPL)
* [SPL](https://concatenative.org/wiki/view/SPL)
* [Staapl](https://concatenative.org/wiki/view/Staapl)
* [Stabel](https://concatenative.org/wiki/view/Stabel)
* [Tal](https://concatenative.org/wiki/view/Tal)
* [Titan](https://concatenative.org/wiki/view/Titan)
* [Trith](https://concatenative.org/wiki/view/Trith)
* [Uiua](https://concatenative.org/wiki/view/Uiua)
* [Worst](https://concatenative.org/wiki/view/Worst)
* [xs](https://concatenative.org/wiki/view/xs)
* [XY](https://concatenative.org/wiki/view/XY)
* [5th](https://concatenative.org/wiki/view/5th)
* [8th](https://concatenative.org/wiki/view/8th)
Concatenative topics
* [Compilers](https://concatenative.org/wiki/view/Compilers)
* [Interpreters](https://concatenative.org/wiki/view/Interpreters)
* [Type systems](https://concatenative.org/wiki/view/Type%20systems)
* [Object systems](https://concatenative.org/wiki/view/Object%20systems)
* [Quotations](https://concatenative.org/wiki/view/Quotations)
* [Variables](https://concatenative.org/wiki/view/Variables)
* [Garbage collection](https://concatenative.org/wiki/view/Garbage%20collection)
* [Example programs](https://concatenative.org/wiki/view/Example%20programs)
Concatenative meta
* [People](https://concatenative.org/wiki/view/People)
* [Communities](https://concatenative.org/wiki/view/Communities)
* [Events](https://concatenative.org/wiki/view/Events)
Other languages
* [APL](https://concatenative.org/wiki/view/APL)
* [C++](https://concatenative.org/wiki/view/C%2B%2B)
* [Erlang](https://concatenative.org/wiki/view/Erlang)
* [FP trivia](https://concatenative.org/wiki/view/FP%20trivia)
* [Haskell](https://concatenative.org/wiki/view/Haskell)
* [Io](https://concatenative.org/wiki/view/Io)
* [Java](https://concatenative.org/wiki/view/Java)
* [JavaScript](https://concatenative.org/wiki/view/JavaScript)
* [Lisp](https://concatenative.org/wiki/view/Lisp)
* [ML](https://concatenative.org/wiki/view/ML)
* [Oberon](https://concatenative.org/wiki/view/Oberon)
* [RPL](https://concatenative.org/wiki/view/RPL)
* [Self](https://concatenative.org/wiki/view/Self)
* [Slate](https://concatenative.org/wiki/view/Slate)
* [Smalltalk](https://concatenative.org/wiki/view/Smalltalk)
Meta
* [**Search**](http://www.google.com/custom?hl=en&cof=&domains=concatenative.org&btnG=Search&sitesearch=concatenative.org)
* [Farkup wiki format](https://concatenative.org/wiki/view/Farkup)
* [Etiquette](https://concatenative.org/wiki/view/Etiquette)
* [Sandbox](https://concatenative.org/wiki/view/Sandbox)
# Concatenative language
There are many ways to categorize programming languages; one is to define them as either "concatenative" or "applicative". In an applicative language, things are evaluated by applying functions to arguments. This includes almost all programming languages in wide use, such as [C](https://concatenative.org/wiki/view/C), [Python](https://concatenative.org/wiki/view/Python), [ML](https://concatenative.org/wiki/view/ML), [Haskell](https://concatenative.org/wiki/view/Haskell), and [Java](https://concatenative.org/wiki/view/Java). In a concatenative programming language, things are evaluated by composing several functions which all operate on a single piece of data, passed from function to function. This piece of data is usually in the form of a stack. Additionally, in concatenative languages, this function composition is indicated by concatenating programs. Examples of concatenative languages include [Forth](https://concatenative.org/wiki/view/Forth), [Joy](https://concatenative.org/wiki/view/Joy), [PostScript](https://concatenative.org/wiki/view/PostScript), [Cat](https://concatenative.org/wiki/view/Cat), and [Factor](https://concatenative.org/wiki/view/Factor).
# Concatenative and stack languages
Although the terms *stack language* and *concatenative language* sometimes get thrown around interchangeably, they actually represent similar but distinct classes of languages. A concatenative language is not necessarily a stack language. For example, [Om](https://concatenative.org/wiki/view/Om) uses prefix notation, rather than postfix, and passes the remainder of the program as the data from function to function. See [Deque](https://concatenative.org/wiki/view/Deque) for another example of a stack-free concatenative language.
Stacks are a pretty fundamental concept in computer science, and many languages use stacks internally in the implementation. Any language that allows recursive definitions uses some type of call stack to save return addresses between function calls, and often the same stack is used to spill values which cannot be allocated in registers. However, this is just implementation detail, and this call stack is not exposed directly to the programmer (except in languages with first-class continuations; I'll touch upon this later).
So what makes stack languages different? The key concept here is that there are *multiple* stacks: all stack languages have a call stack to support recursion, but they also have a data stack (sometimes called an operand stack) to pass values between functions. The latter is what stack language programmers mean when they talk about "the" stack.
Most languages in widespread use today are *applicative languages*: the central construct in the language is some form of function call, where a function is *applied* to a set of parameters, where each parameter is itself the result of a function call, the name of a variable, or a constant. In stack languages, a function call is made by simply writing the name of the function; the parameters are implicit, and they have to *already* be on the stack when the call is made. The result of the function call (if any) is then left on the stack after the function returns, for the next function to consume, and so on. Because functions are invoked simply by mentioning their name without any additional syntax, Forth and Factor refer to functions as "words", because in the syntax they really are just words.
# One mutable stack or functions from stacks to stacks?
Sometimes, people talk about words pushing and popping values on "the stack". Other programmers, mostly those who prefer the term "concatenative language", instead talk about words as being functions which take a stack as input, and return a whole new stack as output. The first point of view is more intuitive, and it is also how most implementations work: there really is a location in memory that is the data stack. The latter is more amenable to formal reasoning: it is easier to work with rewrite rules and type systems if your functions are pure. However, these two points of view are equivalent: because in a given thread of execution, only one stack is "live" at any given point in time, updating the stack in-place has the same semantics as the purely functional world view. More details about this can be found in [Manfred von Thun](https://concatenative.org/wiki/view/Manfred%20von%20Thun)'s paper [Mathematical Foundations of Joy](https://hypercubed.github.io/joy/html/j02maf.html).
# Fundamentals of concatenative languages
* [Name code not values](https://concatenative.org/wiki/view/Concatenative%20language/Name%20code%20not%20values)
* [Multiple return values](https://concatenative.org/wiki/view/Concatenative%20language/Multiple%20return%20values)
* [Concatenation is composition](https://concatenative.org/wiki/view/Concatenative%20language/Concatenation%20is%20composition)
* [Left to right evaluation](https://concatenative.org/wiki/view/Concatenative%20language/Left%20to%20right%20evaluation)
# Concatenative idioms
* [Keyword parameters](https://concatenative.org/wiki/view/Concatenative%20language/Keyword%20parameters)
* [Rest parameters](https://concatenative.org/wiki/view/Concatenative%20language/Rest%20parameters)
* [Pipeline style](https://concatenative.org/wiki/view/Pipeline%20style)
# Other interesting properties
* [Concision](https://concatenative.org/wiki/view/Concatenative%20language/Concision)
* [Simplicity](https://concatenative.org/wiki/view/Concatenative%20language/Simplicity)
* [Meta-programming](https://concatenative.org/wiki/view/Concatenative%20language/Meta-programming)
* [Continuations](https://concatenative.org/wiki/view/Concatenative%20language/Continuations)
* [Interactive development](https://concatenative.org/wiki/view/Concatenative%20language/Interactive%20development)
# Publications
* [Publications](https://concatenative.org/wiki/view/Concatenative%20language/Publications)
*This revision created on Fri, 10 Sep 2021 18:36:34 by [AliAsshole](https://concatenative.org/wiki/user-edits/AliAsshole)
(Replaced dead link with live one)*
[Latest](https://concatenative.org/wiki/view/Concatenative%20language)
[Revisions](https://concatenative.org/wiki/revisions/Concatenative%20language)
[Edit](https://concatenative.org/wiki/edit/Concatenative%20language)
Delete
All content is © 2008-2024 by its respective authors. By adding content to this wiki, you agree to release it under the [BSD license](https://factorcode.org/license.txt).

View File

@@ -0,0 +1,71 @@
# Factor
**Source:** https://factorcode.org
Factor programming language
![Factor programming language](logo.png)
# Why Factor
The **Factor programming language** is a [concatenative](http://www.concatenative.org/), stack-based programming language with [high-level features](http://concatenative.org/wiki/view/Factor/Features/The%20language) including dynamic types, extensible syntax, macros, and garbage collection. On a practical side, Factor has a [full-featured library](http://docs.factorcode.org/content/article-vocab-index.html), supports many different platforms, and has been extensively documented.
The implementation is [fully compiled](http://concatenative.org/wiki/view/Factor/Optimizing%20compiler) for performance, while still supporting [interactive development](http://concatenative.org/wiki/view/Factor/Interactive%20development). Factor applications are portable between all common platforms. Factor can [deploy stand-alone applications](http://concatenative.org/wiki/view/Factor/Deployment) on all platforms. Full [source code](https://github.com/factor/factor) for the Factor project is available under a [BSD license](https://factorcode.org/license.txt).
* [Learn more about Factor](https://concatenative.org/wiki/view/Factor)
* [Get started programming with Factor](https://concatenative.org/wiki/view/Factor/Learning)
* [Get answers to frequently-asked questions](https://concatenative.org/wiki/view/Factor/FAQ)
* [Read Factor documentation online](https://docs.factorcode.org/)
* [Learn about concatenative programming](https://concatenative.org/wiki/view/Concatenative%20language)
* [See some example programs](https://concatenative.org/wiki/view/Factor/Examples)
* [Report a bug](https://github.com/factor/factor/issues)
* Screenshots on [macOS](https://factorcode.org/factor-macos.png), [Windows](https://factorcode.org/factor-windows7.png)
```
USING: io kernel sequences ;
4 <iota> [
"Happy Birthday " write
2 = "dear NAME" "to You" ? print
] each
```
# Downloads
To download a binary, follow the link for the desired OS / CPU configuration. Binary packages are the recommended route for new users who wish to try Factor.
## Stable release: [0.101](https://re.factorcode.org/2025/12/factor-0-101-now-available.html)
| OS/CPU | Windows | macOS | Linux |
| --- | --- | --- | --- |
| x86 | [0.101](https://builds.factorcode.org/release?os=windows&cpu=x86.32) | | [0.101](https://builds.factorcode.org/release?os=linux&cpu=x86.32) |
| x86-64 | [0.101](https://builds.factorcode.org/release?os=windows&cpu=x86.64) | [0.101](https://builds.factorcode.org/release?os=macos&cpu=x86.64) | [0.101](https://builds.factorcode.org/release?os=linux&cpu=x86.64) |
**Source code**:
[0.101](https://downloads.factorcode.org/releases/0.101/factor-src-0.101.zip)
## Development release
| OS/CPU | Windows | macOS | Linux |
| --- | --- | --- | --- |
| x86 | [2025-12-17](https://builds.factorcode.org/package?os=windows&cpu=x86.32) | | [2026-02-11](https://builds.factorcode.org/package?os=linux&cpu=x86.32) |
| x86-64 | [2025-12-17](https://builds.factorcode.org/package?os=windows&cpu=x86.64) | [2026-02-09](https://builds.factorcode.org/package?os=macos&cpu=x86.64) | [2026-02-11](https://builds.factorcode.org/package?os=linux&cpu=x86.64) |
**Source code**: available via [github](https://github.com/factor/factor/) or [gitweb](https://gitweb.factorcode.org/) or [cgit](https://cgit.factorcode.org/).
Stable and development releases are built and uploaded by the [build farm](https://concatenative.org/wiki/view/Factor/Build%20farm). Follow [@FactorBuilds](https://twitter.com/FactorBuilds) on Twitter to receive notifications. If you're curious, take a look at the [build farm dashboard](https://builds.factorcode.org/dashboard). You can also [build Factor](https://concatenative.org/wiki/view/Factor/Building%20Factor) on your own platform from source.
## Older releases
[Download older releases](https://downloads.factorcode.org/releases/) from [Factor 0.29](https://downloads.factorcode.org/releases/0.29/) to the current release.
# Community
* [Join the mailing list](https://concatenative.org/wiki/view/Factor/Mailing%20list)
* [Join the Discord](https://discord.gg/QxJYZx3QDf)
* [Join the IRC channel](https://concatenative.org/wiki/view/Concatenative%20IRC%20channel)
* [Factor community blogs](https://planet.factorcode.org/)
* [Factor community pastebin](https://paste.factorcode.org/) - if you're in an IRC channel and want to share some code
* [Academic publications](https://concatenative.org/wiki/view/Concatenative%20language/Publications)

View File

@@ -0,0 +1,377 @@
# Forth- The Early Years
**Source:** https://colorforth.github.io/HOPL.html
Chuck Moore: The Invention of Forth
# Forth - The Early Years
Chuck Moore
[chipchuck@colorforth.com](mailto:chipchuck@colorforth.com)
1991
## Abstract
Forth is a simple, natural computer language. It has achieved remarkable acceptance where efficiency is valued. It evolved in the 1960s on a journey from university through business to laboratory. This is the story of how a simple interpreter expanded its abilities to become a complete programming language/operating system.
## Forward 1999
This paper was written for the HOPL II (History of programming languages) conference. It was summarily rejected, apparently because of its style. Much of the content was included in the accepted paper [Rather 1993].
This HTML version was reformatted from the original typescript. Minimal changes were made to the text. Examples of source code were suggested by reviewer Phil Koopman. They've not yet been added.
## Contents
Forth
MIT, SAO, 1958
Stanford, SLAC, 1961
Free-lance, 1965
Mohasco, 1968
NRAO, 1971
Moral
## Forth
Forth evolved during the decade of the 60s, across America, within university, business and laboratory, amongst established languages. During this period, I was its only programmer and it had no name until the end. This account is retrieved from memory, prompted by sparse documentation and surviving listings.
Forth is hardly original, but it is a unique combination of ingredients. I'm grateful to the people and organizations who permitted me to develop it - often unbeknownst to them. And to you, for being interested enough to read about it.
Forth is a simple, natural computer language. Today it is accepted as a world-class programming language. That it has achieved this without industry, university or government support is a tribute to its efficiency, reliability and versatility. Forth is the language of choice when its efficiency outweighs the popularity of other languages. This is more often the case in real-world applications such as control and communication.
A number of Forth organizations and a plethora of small companies provide systems, applications and documentation. Annual conferences are held in North America, Europe and Asia. A draft ANSI standard will soon be submitted [ANS 1991].
None of the books about Forth quite capture its flavor. I think the best is still the first, Starting Forth by Leo Brodie [Brodie 1981]. Another window is provided by JFAR's invaluable subject and author index [Martin 1987].
The classic Forth we are discussing provides the minimum support a programmer needs to develop a language optimized for his application. It is intended for a work-station environment: keyboard, display, computer and disk.
Forth is a text-based language that is essentially context-free. It combines 'words' separated by spaces, to construct new words. About 150 such words constitute a system that provides (with date of introduction)
```
SAO 1958 Interpreter
SLAC 1961 Data stack
RSI 1966 Keyboard input
Display output, OK
Editor
Mohasco 1968 Compiler
Return stack
Dictionary
Virtual memory (disk)
Multiprogrammer
NRAO 1971 Threaded code
Fixed-point arithmetic
```
Such a system has 3-8K bytes of code compiled from 10-20 pages of source. It can easily be implemented by a single programmer on a small computer.
This account necessarily follows my career. But it is intended to be the autobiography of Forth. I will discuss the features listed above; and the names of the words associated with them. The meaning of many words is obvious. Some warrant description and some are beyond the scope of this paper.
That portion of the Forth dictionary to be mentioned is summarized here:
```
Interpreter
WORD NUMBER INTERPRET ABORT
HASH FIND ' FORGET
BASE OCTAL DECIMAL HEX
LOAD EXIT EXECUTE (
Terminal
KEY EXPECT
EMIT CR SPACE SPACES DIGIT TYPE DUMP
Data stack
DUP DROP SWAP OVER
+ - * / MOD NEGATE
ABS MAX MIN
AND OR XOR NOT
0< 0= =
@ ! +! C@ C!
SQRT SIN.COS ATAN EXP LOG
Return stack
: ; PUSH POP I
Disk
BLOCK UPDATE FLUSH BUFFER PREV OLDEST
Compiler
CREATE ALLOT , SMUDGE
VARIABLE CONSTANT
[ ] LITERAL ." COMPILE
BEGIN UNTIL AGAIN WHILE REPEAT
DO LOOP +LOOP IF ELSE THEN
```
## MIT, SAO, 1958
October, 1957 was Sputnik - a most exciting time. I was a sophmore at MIT and got a part-time job with SAO (Smithsonian Astrophysical Observatory, 14 syllables) at Harvard.
SAO was responsible for optical tracking of satellites - Moonwatch visual observations and Baker-Nunn tracking cameras. Caught off-guard by Sputnik, they hired undergraduates to compute predictions with Friden desk calculators. John Gaustad told me about MIT's IBM EDPM 704 and loaned me his Fortran II manual. My first program, Ephemeris 4, eliminated my job [Moore 1958].
Now a Programmer, I worked with George Veis to apply his method of least-squares fitting to determine orbital elements, station positions and ultimately the shape of Earth [Veis 1960]. Of course, this part-time job was at least 40 hours, and yes, my grades went to hell.
At MIT, John McCarthy taught an incredible course on LISP. That was my introduction to recursion, and to the marvelous variety of computer language. Wil Baden has noted that LISP is to Lambda Calculus as Forth is to Lukasewcleicz Postfix.
APL was also a topical language, with its weird right-left parsing. Although I admire and emulate its operators, I'm not persuaded they constitute an optimal set.
The programming environment in the 50s was more severe than today. My source code filled 2 trays with punch cards. They had to be carried about to be put through machines, mostly by me. Compile took 30 minutes (just like C) but limited computer time meant one run per day, except maybe 3rd shift.
So I wrote this simple interpreter to read input cards and control the program. It also directed calculations. The five orbital elements each had an empirical equation to account for atmospheric drag and the non-spherical Earth. Thus I could compose different equations for the several satellites without re-compiling.
These equations summed terms such as P2 (polynomial of degree 2) and S (sine). 36-bit floating-point dominated calculation time so overhead was small. A data stack was unnecessary, and probably unknown to me.
The Forth interpreter began here with the words
```
WORD NUMBER INTERPRET ABORT
```
They weren't spelled that way because they were statement numbers.
INTERPRET uses WORD to read words separated by spaces and NUMBER to convert a word to binary (in this case, floating-point). Such free-format input was unusual, but was more efficient (smaller and faster) and reliable. Fortran input was formatted into specific columns and typographic errors had caused numerous delays.
This interpreter used an IF ... ELSE IF construct, coded in Fortran, finding a match on a single character. Error handling consisted of terminating the run. Then, as now, ABORT asked the user what to do. Since input cards were listed as they were read, you knew where the error was.
## Stanford, SLAC, 1961
In 1961 I went to Stanford to study mathematics. Although Stanford was building its computer science department, I was interested in real computing. I was impressed that they could (dared?) write their own Algol compiler. And I fatefully encountered the Burroughs B5500 computer.
I got another 'part-time' job at SLAC (Stanford Linear Accelerator Center, 12 syllables) writing code to optimize beam steering for the pending 2-mile electron accelerator. This was a natural application of my least-squares experience to phase-space. Hal Butler was in charge of our group and the program, TRANSPORT, was quite successful.
Another application of least-squares was the program CURVE, coded in Algol (1964). It is a general-purpose non-linear differential-corrections data-fitting program. Its statistical rigor provides insight into agreement between model and data.
The data format and model equations were interpreted and a push-down stack used to facilitate evaluation. CURVE was an impressive precursor to Forth. It introduced these words to provide the capability to fit models much more elaborate than simple equations:
```
+ - * NEGATE
IF ELSE THEN <
DUP DROP SWAP
: ; VARIABLE ! (
SIN ATAN EXP LOG
```
Spelling was quite different:
```
NEGATE was MINUS
DROP ;
SWAP .
! <
VARIABLE DECLARE
; END
( ...) COMMENT ...;
```
The interpreter used IF ... ELSE IF to identify a 6-character input word called ATOM (from LISP). DUP DROP and SWAP are 5500 instructions; I'm surprised at the spelling change. The word : was taken from the Algol label format, flipped for left-right parsing (to prevent the interpreter encountering an undefined word):
```
Algol - LABEL:
CURVE - : LABEL
```
In fact, : marked a position in the input string to be interpreted later. Interpretation was stopped by ; . A version of : was named DEFINE .
The store operator ( ! ) appeared in connection with VARIABLE . But fetching ( @ ) was automatic. Note the input had become complex enough to warrant comments. The sometime-criticised postfix conditional dates from here:
```
Algol - IF expression THEN true ELSE false
CURVE - stack IF true ELSE false THEN
```
True is interpreted if stack is non-zero. THEN provides unique termination, the lack of which always confused me in Algol. Such expressions were interpreted: IF would scan ahead for ELSE or THEN.
The word < introduces the convention that relations leave a truth value on the stack, 1 for true and 0 for false. The transcendental functions are, of course, library calls.
## Free-lance
I left Stanford in 1965 to become a free-lance programmer in the New York City area. This was not unusual, and I found work programming in Fortran, Algol, Jovial, PL/I and various assemblers. I literally carried my card deck about and recoded it as necessary.
Minicomputers were appearing, and with them terminals. The interpreter was ideal for teletype input, and soon included code to handle output. So we aquire the words
```
KEY EXPECT
EMIT CR SPACE SPACES DIGIT TYPE
```
EXPECT is a loop calling KEY to read a keystroke. TYPE is a loop calling EMIT to display a character.
With the TTY came paper-tape and some of the most un-friendly software imaginable - hours of editing and punching and loading and assembling and printing and loading and testing and repeating. I remember a terrible Sunday in a Manhattan skyscraper when I couldn't find splicing tape (nothing else works) and swore that 'There must be a better way'.
I did considerable work for Bob Davis at Realtime Systems, Inc (RSI). I became a 5500 MCP guru to support his time-sharing service (remote input to a mainframe) and wrote a Fortran-Algol translator and file editing utilities. The translator taught me the value of spaces between words, not required by Fortran.
The interpreter still accepted words with the first 6 characters significant (the 5500 had 48-bit words). The words
```
LIST EDIT BEGIN AGAIN EXIT
```
appear, with BEGIN ... AGAIN spelled START ... REPEAT and used to bracket the editor commands
```
T TYPE I INSERT D DELETE F FIND
```
later used in NRAO's editor. The word FIELD was used in the manner of Mohasco and Forth, Inc's data-base management.
One of Forth's distinctive features comes from here. The rule is that Forth acknowledge each line of input by appending OK when interpretation is complete. This may be difficult, for when input is terminated by CR a blank must be echoed, and the CR included with OK. At RSI, OK was on the next line, but it still conveyed friendly reassurance over an intimidating communications line:
```
56 INSERT ALGOL IS VERY ADAPTABLE
OK
```
This postfix notation suggests a data stack, but it only had to be one deep.
## Mohasco, 1968
In 1968 I transformed into a business programmer at Mohasco Industries, Inc in Amsterdam NY. They are a major home-furnishing company - carpets and furniture. I had worked with Geoff Leach at RSI and he persuaded me to follow him up-state. I had just married, and Amsterdam has a lovely small-town atmosphere to contrast with NYC.
I rewrote my code in COBOL and learned the truth about business software. Bob Rayco was in charge of Corporate data processing and assigned me two relevant projects:
He leased an IBM 1130 minicomputer with a 2250 graphic display. The object was to see if computer graphics helped design patterned carpets. The answer was 'not without color' and the 1130 went away.
Meanwhile I had the latest minicomputer environment: 16-bit CPU, 8K RAM, disk (my first), keyboard, printer, card reader/punch, Fortran compiler. The reader/punch provided disk backup. I ported my interpreter again (back to Fortran) and added a cross-assembler to generate code for the 2250.
The system was a great success. It could draw animated 3-D images when IBM could barely draw static 2-D. Since this was my first real-time graphics, I coded Spacewar, that first video game. I also converted my Algol chess program into Forth and was duely impressed how much simpler it became.
The file holding the interpreter was labeled FORTH, for 4th (next) generation software - but the operating system restricted file names to 5 characters.
This environment for programming the 2250 was far superior to the Fortran environment, so I extended the 2250 cross-assembler into an 1130 compiler. This introduced a flock of words
```
DO LOOP UNTIL
BLOCK LOAD UPDATE FLUSH
BASE CONTEXT STATE INTERPRET DUMP
CREATE CODE ;CODE CONSTANT SMUDGE
@ OVER AND OR NOT 0= 0<
```
They were still differently spelled
```
LOOP was CONTINUE
UNTIL END
BLOCK GET
LOAD READ
TYPE SEND
INTERPRET QUERY
CREATE ENTER
CODE the cent symbol
```
The only use I've ever found for the cent symbol. The loop index and limit were on the data stack. DO and CONTINUE were meant to acknowledge Fortran.
BLOCK manages a number of buffers to minimize disk access. LOAD reads source from a 1024-byte block. 1024 was chosen as a nice modular amount of disk, and has proven a good choice. UPDATE allows a block to be marked and later rewritten to disk, when its buffer is needed (or by FLUSH ). It implements virtual memory and is concealed in store ( ! ) words.
BASE allows octal and hex numbers as well as decimal. CONTEXT was the first hint of vocabularies and served to isolate editor words. STATE distinguished compiling from interpreting. During compilation, the count and first 3 characters of a word were compiled for later interpretation. Strangely, words could be terminated by a special character, an aberration quickly abandoned. The fetch operator ( @ ) appeared in many guises, since fetching from variables, arrays and disk had to be distinguished. DUMP became important for examining memory.
But most important, there was now a dictionary. Interpret code now had a name and searched a linked-list for a match. CREATE constructs the classic dictionary entry:
```
link to previous entry
count and 3 characters
code to be executed
parameters
```
The code field was an important innovation, since an indirect jump was the only overhead, once a word had been found. The value of the count in distinguishing words, I learned from the compiler writers of Stanford.
An important class of words appeared with CODE . Machine instructions followed in the parameter field. So any word within the capability of the computer could now be defined. ;CODE specifies the code to be executed for a new class of words, and introduced what are now called objects.
SMUDGE avoided recursion during the interpretation of a definition. Since the dictionary would be searched from newest to oldest definitions, recursion would normally occur.
Finally, the return stack appeared. Heretofor, definitions had not been nested, or used the data stack for their return address. Altogether a time of great innovation in the punctuated evolution of Forth.
The first paper on Forth, an internal Mohasco report, was written by Geoff and me [Moore 1970]. It would not be out of place today.
In 1970 Bob ordered a Univac 1108. An ambitious project to support a network of leased lines for an order-entry system. I had coded a report generator in Forth and was confident I could code order-entry. I ported Forth to the 5500 (standalone!) to add credibility. But corporate software was COBOL. The marvelous compromise was to install a Forth system on the 1108 that interfaced with COBOL modules to do transaction processing.
I vividly recall commuting to Schenectady that winter to borrow 1107 time 3rd shift. My TR4-A lacked floor and window so it became a nightly survival exercise. But the system was an incredible success. Even Univac was impressed with its efficiency (Les Sharp was project liason). The ultimate measure was response time, but I was determined to keep it maintainable (small and simple). Alas, an economic downturn led Management to cancel the 1108. I still think it was a bad call. I was the first to resign.
1108 Forth must have been coded in assembler. It buffered input and output messages and shared the CPU among tasks handling each line. Your classic operating system. But it also interpreted the input and PERFORMed the appropriate COBOL module. It maintained drum buffers and packed/unpacked records. The words
```
BUFFER PREV OLDEST
TASK ACTIVATE GET RELEASE
```
date from here. BUFFER avoided a disk read when the desired block was known empty. PREV (previous) and OLDEST are system variables that implement least-recently-used buffer management. TASK defines a task at boot time and ACTIVATE starts it when needed. GET and RELEASE manage shared resources (drum, printer). PAUSE is how a task relinquishes control of the CPU. It is included in all I/O operations and is invisible to transaction code. It allows a simple round-robin scheduling algorithm that avoids lock-out.
After giving notice, I wrote an angry poem and a book that has never been published. It described how to develop Forth software and encouraged simplicity and innovation. It also described indirect-threaded code, but the first implementation was at NRAO.
I struggled with the concept of meta-language, language that talks about language. Forth could now interpret an assembler, that was assembling a compiler, that would compile the interpreter. Eventually I decided the terminology wasn't helpful, but the term Meta-compile for recompiling Forth is still used.
## NRAO, 1971
George Conant offered me a position at NRAO (National Radio Astronomy Observatory, 15 syllables). I had known him at SAO and he liked Ephemeris 4. So we moved to Charlottesville VA and spent summers in Tucson AZ when the radio-telescope on Kitt Peak was available for maintainance.
The project was to program a Honeywell 316 minicomputer to control a new filter-bank for the 36' millimeter telescope. It had a 9-track tape and Tektronix storage-tube terminal. George gave me a free hand to develop the system, though he wasn't pleased with the result. NRAO was a Fortran shop and by now I was calling Forth a language. He was right in that organizations have to standardize on a single language. Other programmers now wanted their own languages.
Anyhow, I had coded Forth in assembler on the IBM 360/50 mainframe. Then I cross-compiled it onto the 316. Then I re-compiled it on the 316 (Although I had a terminal on the 360, response time was terrible). The application was easy once the system was available. There were two modes of observing, continuum and spectral-line. Spectral-line was the most fun, for I could display spectra as they were collected and fit line-shapes with least-squares [Moore 1973].
The system was well-received in Tucson, where Ned Conklin was in charge. It did advance the state-of-the-art in on-line data reduction. Astronomers used it to discover and map inter-stellar molecules just as that became hot research.
Bess Rather was hired to provide on-site support. She had first to learn the Forth system and then explain and document it, with minimal help from me. The next year I reprogrammed the DDP-116 to optimize telescope pointing. The next, Bess and I replaced the 116 and 316 with a DEC PDP-11.
The development that made all this possible was indirect-threaded code. It was a natural development from my work at Mohasco, though I later heard that DEC had used direct-threaded code in one of their compilers. Rather than re-interpret the text of a definition, compile the address of each dictionary entry. This improved efficiency for each reference required only 2 bytes and an address interpreter could sequence through a definition enormously faster. In fact, this interpreter was a 2-word macro on the 11:
```
: NEXT IP )+ W MOV W )+ ) JMP ;
```
Now Forth was complete. And I knew it. I could write code more quickly that was more efficient and reliable. Moreover, it was portable. I proceeded to recode the 116 pointing the 300' Green Bank telescope, and the HP mini that was inaugurating VLBI astronomy. George gave me a ModComp and I did Fourier transforms for interferometry and pulsar search (64K data). I even demonstrated that complex multiply on the 360 was 20% faster in Forth than assembler.
NRAO appreciated what I had wrought. They had an arrangement with a consulting firm to identify spin-off technology. The issue of patenting Forth was discussed at length. But since software patents were controversial and might involve the Supreme Court, NRAO declined to pursue the matter. Whereupon, rights reverted to me. I don't think ideas should be patentable. Hindsight agrees that Forth's only chance lay in the public domain. Where it has flourished.
Threaded-code changed the structure words (such as DO LOOP IF THEN ). They acquired an elegant implementation with addresses on the data stack during compilation.
Now each Forth had an assembler for its particular computer. It uses post-fix op-codes and composes addresses on the data stack, with Forth-like structure words for branching. The manufacturer's mnemonics are defined as word classes by ;CODE . Might take an afternoon to code. An example is the macro for NEXT above.
Unconventional arithmetic operators proved their value
```
M* */ /MOD SQRT SIN.COS ATAN EXP LOG
```
M\* is the usual hardware multiply of 2 16-bit numbers to a 32-bit product (arguments, of course, on the data stack). \*/ follows that with a divide to implement rational arithmetic. /MOD returns both quotient and remainder and is ideal for locating records within a file. SQRT produces a 16-bit result from a 32-bit argument. SIN.COS returns both sine and cosine as is useful for vector and complex arithmetic (FFT). ATAN is its inverse and has no quadrant ambiguity. EXP and LOG were base 2.
These functions used fixed-point arithmetic - 14 or 30 bits right of a binary point for trig, 10 for logs. This became a characteristic of Forth since it's simpler, faster and more accurate than floating-point. But hardware and software floating-point are easy to implement.
I'd like to applaud the invaluable work of Hart [Hart 1978] in tabulating function approximations with various accuracies. They have provided freedom from the limitations of existing libraries to those of us in the trenches.
The word DOES> appeared (spelled ;: ). It defines a class of words (like ;CODE ) by specifying the definition to be interpreted when the word is referenced. It was tricky to invent, but particularly useful for defining op-codes.
Nonetheless, I failed to persuade Charlottesville that Forth was suitable. I wasn't going to be allowed to program the VLA. Of any group, 25% like Forth and 25% hate it. Arguments can get violent and compromise is rare. So the friendlies joined forces and formed Forth, Inc. And that's another story.
## Moral
The Forth story has the making of a morality play: Persistant young programmer struggles against indifference to discover Truth and save his suffering comrades. It gets better: Watch Forth. Inc go head to head with IBM over a French banking system.
I know Forth is the best language so far. I'm pleased at its success, especially in the ultra-conservative arena of Artificial Intelligence. I'm disturbed that people who should, don't appreciate how it embodies their own description of the ideal programming language.
But I'm still exploring without license. Forth has led to an architecture that promises a wonderful integration of software and silicon. And another new programming environment.
## References
[ANS 1991] Draft Proposed ANS Forth, document number X3.215-199x, available from Global Engineering Documents, 2805 McGaw Ave., Irvine CA 92714.
[Brodie, 1981] Brodie, Leo, Starting FORTH, Englewood Cliffs NJ: Prentice-Hall, 1981, ISBN 0 13 842930 8.
[Hart, 1968] Hart, John F. et al, Computer Approximations. Malabar FL: Krieger, 1968; (Second Edition), 1978, ISBN 0 88275 642 7.
[Martin, 1987] Martin, Thea, A Bibliography of Forth References, 3rd Ed, Rochester NY: Institute for Applied Forth Research, 1987, ISBN 0 914593 07 2.
[Moore, 1958] Moore, Charles H. and Lautman, Don A., Predictions for photographic tracking stations - APO Ephemeris 4, in SAO Special Report No. 11, Schilling G. F., Ed., Cambridge MA: Smithsonian Astrophysical Observatory, 1958 March.
[Moore, 1970] --- and Leach, Geoffrey C., FORTH - A Language for Interactive Computing, Amsterdam NY: Mohasco Industries, Inc. (internal pub.) 1970.
[Moore, 1972] --- and Rather, Elizabeth D., The FORTH program for spectral line observing on NRAO's 36 ft telescope, Astronomy & Astrophysics Supplement Series, Vol. 15, No. 3, 1974 June, Proceedings of the Symposium on the Collection and Analysis of Astrophysical Data, Charlottesville VA, 1972 Nov. 13-15.
[Moore, 1980] ---, The evolution of FORTH, an unusual language, Byte, 5:8, 1980 August.
[Rather, 1993] Rather, Elizabeth D., Colburn, Donald R. and Moore, Charles H., The Evolution of Forth, in History of Programming Languages-II, Bergin T. J. and Gibson, R. G., Ed., New York NY: Addison-Wesley, 1996, ISBN 0-201-89502-1.
[Veis, 1960] Veis, George and Moore, C. H., SAO differential orbit improvement program, in Tracking Programs and Orbit Determination Seminar Proceedings, Pasadena CA: JPL, 1960 February 23-26.

View File

@@ -0,0 +1,42 @@
# Forth
**Source:** https://www.taygeta.com/forth.html
Forth Information on Taygeta, Taygeta Scientific Inc.
# Forth Information on Taygeta
*Last updated 26 November 2004*
![====](/icons/maroonbar.gif)
Taygeta Scientific provides custom software and consulting for applications
using Forth for real-time applications, embedded systems, signal processing,
robotics, Unix scripting, and WWW CGI programs.
[Contact us](mailto:office@taygeta.com) for details.
---
![](/icons/archiv.gif) [**Forth Literature and Education**](forthlit.html)
---
### Software:
![](/icons/star.gif) [**Forth Compilers**](forthcomp.html) ![](/icons/star.gif) [**TCP/IP networking with Forth**](networking/forthnet.html)
#### Applications:
![](/icons/pink.gif) John Hayes's ANS compiler validation program (27 Nov 95 version) (two files), [tester.fr V1.1](ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/tester.fr) and [core.fr V1.2](ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/core.fr) ![](/icons/pink.gif) The [Forth Scientific Library](fsl/sciforth.html) project Info ![](/icons/pink.gif) The [UUDECODE utility](ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/uudecode.seq) (ANS). ![](/icons/pink.gif) The [UUENCODE utility](ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/uuencode.seq) (ANS). ![](/icons/pink.gif) The **LZ77 Data Compression** utility, [Info](ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/lzss.doc), and [code](ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/lzss.fo). ![](/icons/pink.gif) An implementation of the [**ANS Memory-Allocation Wordset**](ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/memory.fth).
#### Development tools:
![](/icons/pink.gif) [**Joerg Plewe**'s **ANS Debugger (From Forth Dimensions)**](ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/debugger.ans) ![](/icons/pink.gif) [EMACS Forth Mode](ftp://ftp.taygeta.com/pub/Forth/Tools/forth.el) elisp file (V2.10) by **Goran Rydqvist**. ![](/icons/pink.gif) A [Condordance generator for Forth source files](ftp://ftp.taygeta.com/pub/Forth/Tools/concordance.fth) (V1.6) [(PFE version)](ftp://ftp.taygeta.com/pub/Forth/Tools/pfe/concordance.fth) ![](/icons/pink.gif) An [EMACS **TAGS** for Forth source files](ftp://ftp.taygeta.com/pub/Forth/Tools/ftags.fth) (V1.5) [(PFE version)](ftp://ftp.taygeta.com/pub/Forth/Tools/ftags.fth) ![](/icons/pink.gif) A [Forth source code obfuscator](ftp://ftp.taygeta.com/pub/Forth/Tools/gfob-0.1.0.tar.gz) (V0.1.0) by **Pierre Abbat** ([phma@trellis.net](mailto:phma@trellis.net)).
#### Interesting Forth Applications: [Gray Forth Parser generator](ftp://ftp.complang.tuwien.ac.at/pub/forth) (ANS version) [MIX emulator, assembler, disassembler](ftp://iaehv.iaehv.nl/pub/users/mhx) by **Marcel Hendrix**. 190 MB of Forth Online ! --- Other WWW Forth resources: [The **Forth Interest Group** home page](http://www.forth.org). --- Sites: [AM Research](http://www.amresearch.com) Embedded control systems page with Forth information and software [ATHENA](ftp://ftp.uu.net/vendor/minerva/uathena.htm) Programming, Inc. [ftp.cygnus.com](ftp://ftp.cygnus.com/pub/forth) Forth directory. [Asterix FTP](ftp://ftp.dei.isep.ipp.pt/pub/forth) site (Portugal), [Asterix MIRROR FTP](ftp://col.hp.com/mirrors) site. The [**Forth Research Page at Bournemouth**](http://dec.bournemouth.ac.uk/forth). * The [**DeloSoft**](http://www.delosoft.com/) site, has **dsForth** for WindowsCE on MIPS, SH3 and Intel processors. [ForthChip](http://www.forthchip.com/), a site primarily about the F21 family of processors [**TILE** Forth](ftp://ftp.lysator.liu.se/pub/languages/forth) FTP site. Other [Forth](http://pisa.rockefeller.edu:8080/FORTH/) related info. * The [**Pocket Forth**](http://chemlab.pc.maricopa.edu/pocket.html) site. The [South Ontario FIG Chapter Library](ftp://pc-solntseff-n.dcss.mcmaster.ca) (after hours, 8:30 to 5:30 EST Mondays to Fridays, please). [ACM SIGFORTH](gopher://gopher.acm.org/11[the_files.sig_forums.sigFORTH]) directory. [Forth in French](http://perso.wanadoo.fr/mp7/forth). [ITCN](http://www.cera2.com/forth.htm) Forth Resources page * The [JForth site](http://jforth.org/) (for the Amiga) * The [Pysmatic Forth center](http://www.pysmatic.com/forth/). * The [**Russian Forth Interest Group**](http://www.forth.org.ru/) * The [**EServ (Forth Web Server) Open source site**](http://www.opensource.org.ru/eserv-src/src.html) (in Russian) * [**SP-Forth**](http://www.enet.ru/win/cherezov/) Russian site, Windows 95/NT Forth A list of [Forth applications in space](http://forth.gsfc.nasa.gov) [Transport Control Technology Ltd.](http://www.tcontec.demon.co.uk) Control system design consultants * The [Treasure Isle of Forth](http://www.stejskal.de/web/computer/forth/_index.html) --- **The Forth Webring** [[Prev](http://www.webring.org/cgi-bin/webring?ring=forth&id=10&prev)] [[Random](http://www.webring.org/cgi-bin/webring?random&ring=forth)] [[List Sites](http://www.webring.org/cgi-bin/webring?ring=forth&list)] [[Next](http://www.webring.org/cgi-bin/webring?ring=forth&id=10&next)] [[Next 5](http://www.webring.org/cgi-bin/webring?ring=forth&id=10&next5)] [Dr. Everett (Skip) F. Carter Jr.](EFCBio-General.html) [Taygeta Scientific Inc.](taygeta.html) 1340 Munras Ave., Suite 314 Monterey, CA. 93940-6140 | voice: 831.641.0645 FAX: 831.641.0647 INTERNET:[skip@taygeta.com](http://www.taygeta.com/mailme.html) WWW:<http://www.taygeta.com/> | [Taygeta's home page](http://www.taygeta.com/index.html)

View File

@@ -0,0 +1,17 @@
# Forth Landing
**Source:** https://wiki.c2.com/?ForthLanguage
**notice**
javascript required to view this site
**why**
measured improvement in server performance
awesome incremental search
![](spin.gif)
This site uses features not available in older browsers.

View File

@@ -0,0 +1,17 @@
# Forth Values
**Source:** https://wiki.c2.com/?ForthValues
**notice**
javascript required to view this site
**why**
measured improvement in server performance
awesome incremental search
![](spin.gif)
This site uses features not available in older browsers.

View File

@@ -0,0 +1,311 @@
# GDForth
**Source:** https://github.com/yumaikas/GDForth
GitHub - yumaikas/GDForth: A Forth-alike for better async GDScript
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fyumaikas%2FGDForth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fyumaikas%2FGDForth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=yumaikas%2FGDForth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[yumaikas](/yumaikas)
/
**[GDForth](/yumaikas/GDForth)**
Public
* [Notifications](/login?return_to=%2Fyumaikas%2FGDForth) You must be signed in to change notification settings
* [Fork
0](/login?return_to=%2Fyumaikas%2FGDForth)
* [Star
2](/login?return_to=%2Fyumaikas%2FGDForth)
A Forth-alike for better async GDScript
[2
stars](/yumaikas/GDForth/stargazers) [0
forks](/yumaikas/GDForth/forks) [Branches](/yumaikas/GDForth/branches) [Tags](/yumaikas/GDForth/tags) [Activity](/yumaikas/GDForth/activity)
[Star](/login?return_to=%2Fyumaikas%2FGDForth)
[Notifications](/login?return_to=%2Fyumaikas%2FGDForth) You must be signed in to change notification settings
* [Code](/yumaikas/GDForth)
* [Issues
0](/yumaikas/GDForth/issues)
* [Pull requests
0](/yumaikas/GDForth/pulls)
* [Actions](/yumaikas/GDForth/actions)
* [Projects
0](/yumaikas/GDForth/projects)
* [Security
0](/yumaikas/GDForth/security)
* [Insights](/yumaikas/GDForth/pulse)
Additional navigation options
* [Code](/yumaikas/GDForth)
* [Issues](/yumaikas/GDForth/issues)
* [Pull requests](/yumaikas/GDForth/pulls)
* [Actions](/yumaikas/GDForth/actions)
* [Projects](/yumaikas/GDForth/projects)
* [Security](/yumaikas/GDForth/security)
* [Insights](/yumaikas/GDForth/pulse)
# yumaikas/GDForth
main
[Branches](/yumaikas/GDForth/branches)[Tags](/yumaikas/GDForth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[44 Commits](/yumaikas/GDForth/commits/main/) 44 Commits | | |
| [addons/GDForth](/yumaikas/GDForth/tree/main/addons/GDForth "This path skips through empty directories") | | [addons/GDForth](/yumaikas/GDForth/tree/main/addons/GDForth "This path skips through empty directories") | | |
| [.gitignore](/yumaikas/GDForth/blob/main/.gitignore ".gitignore") | | [.gitignore](/yumaikas/GDForth/blob/main/.gitignore ".gitignore") | | |
| [README.md](/yumaikas/GDForth/blob/main/README.md "README.md") | | [README.md](/yumaikas/GDForth/blob/main/README.md "README.md") | | |
| View all files | | |
## Repository files navigation
* [README](#)
Refer to <./addons/GDForth/README.md> for project details
## About
A Forth-alike for better async GDScript
### Resources
[Readme](#readme-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/yumaikas/GDForth/activity)
### Stars
[**2**
stars](/yumaikas/GDForth/stargazers)
### Watchers
[**1**
watching](/yumaikas/GDForth/watchers)
### Forks
[**0**
forks](/yumaikas/GDForth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fyumaikas%2FGDForth&report=yumaikas+%28user%29)
## [Releases](/yumaikas/GDForth/releases)
No releases published
## [Packages 0](/users/yumaikas/packages?repo_name=GDForth)
No packages published
## Languages
* [GDScript
99.8%](/yumaikas/GDForth/search?l=gdscript)
* [Shell
0.2%](/yumaikas/GDForth/search?l=shell)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
# Homepage
**Source:** https://colorforth.github.io/index.html
Chuck Moore's colorForth, OKAD and S40 Forth Multicomputer chip
### *Updated* 2013 November 6IntroductionThis site is getting some 500-600 visitors a day. Thank you for your interest. *There's a quotation attributed to Burke: "All that is required for evil to triumph is for good men to do nothing."**[Blog](blog.htm)*Comments about life, colorForth and GreenArrays You're welcome to email me your comments. I like to hear from people, and appreciate your suggestions. But there are several problems: * Such email usually arrives in my junk mail folder. I try to retrieve them, but a distinguishing subject line would help.* I won't respond to these emails, except on future postings. 'Cause I don't know who you are, and the the web is full of predators. *[Eval Blog](haypress.htm)*My experience programming GreenArrays' Evaluation Board. [colorForth](cf.htm)A dialect of Forth that uses color to replace punctuation. Native Pentium and Windows versions. Produces extremely compact programs. Instant compile from pre-parsed source. Latest changes are compressed source: colorForth, OKAD and GA4 in 290K (25%). Also blue words that are executed at edit time, for formatting text.[OKAD](vlsi.html)A suite of VLSI design tools for layout and simulation. Compact description of gates, cells and chip. Resulting GDS II file ready for fabrication. [S40 Multicomputer Chip](S40.htm) Spectacular chip! 40 microcomputers, each with 128 words of 18-bit memory. Each capable of 700 Mips. [GreenArrays, Inc](http://greenarraychips.com/)I'm pleased to announce the formation of this company. We plan to develop and exploit the concept of multi-computer chips. That gives me another point of contact: [chuck@greenarraychips.com](mailto:chuck@greenarraychips.com). *[Chuck Moore](bio.html)*[chipchuck@colorforth.com](mailto:chipchuck@colorforth.com) Lives in Nevada at Lake Tahoe. Loves to [hike](hiking.htm) the Tahoe Rim Trail as well as the Pacific Crest Trail. *[Min Moore](min.htm) 1932 - 2005*[Eric Moore](eric.htm)Some pictures of my son[Recipes](recipes.htm)[Programming a Problem-Oriented Language](POL.htm)This is a book I wrote about 1970. It describes the software that became Forth.[Thoughts about Pi](pi.htm)[colorForth Primer](primer.htm)[Books](books.htm)Books I likePoemsSometimes the pros say it best. To be perfectly clear, I've emphasized some lines. [Henry V, Shakespeare [Stout-Hearted Men, Hammerstein](stout.htm) [Invictus, Henley](Invictus.htm) [The Weariest River, Swinburne](WeariestRiver.htm) [Coloring, Sarah Hall Maney](coloring.html) [Road Not Taken, Robert Frost](road.htm) [Mending Wall, Robert Frost](mending.htm) [Stopping by Woods on a Snowy Evening, Robert Frost](stopping.htm) [Ulysses, Alfred Lord Tennyson](tennyson.htm) [The Explorer, Rudyard Kipling](kipling.htm) [My Lost Youth, Henry Wadsworth Longfellow](longfellow.htm) [High Flight, John Gillespie Magee](magee.htm)](Crispin.htm)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,398 @@
# JonesForth-arm
**Source:** https://github.com/M2IHP13-admin/JonesForth-arm
GitHub - M2IHP13-admin/JonesForth-arm
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FM2IHP13-admin%2FJonesForth-arm)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FM2IHP13-admin%2FJonesForth-arm)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=M2IHP13-admin%2FJonesForth-arm)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[M2IHP13-admin](/M2IHP13-admin)
/
**[JonesForth-arm](/M2IHP13-admin/JonesForth-arm)**
Public
* [Notifications](/login?return_to=%2FM2IHP13-admin%2FJonesForth-arm) You must be signed in to change notification settings
* [Fork
52](/login?return_to=%2FM2IHP13-admin%2FJonesForth-arm)
* [Star
89](/login?return_to=%2FM2IHP13-admin%2FJonesForth-arm)
### License
[LGPL-3.0 license](/M2IHP13-admin/JonesForth-arm/blob/master/LICENSE)
[89
stars](/M2IHP13-admin/JonesForth-arm/stargazers) [52
forks](/M2IHP13-admin/JonesForth-arm/forks) [Branches](/M2IHP13-admin/JonesForth-arm/branches) [Tags](/M2IHP13-admin/JonesForth-arm/tags) [Activity](/M2IHP13-admin/JonesForth-arm/activity)
[Star](/login?return_to=%2FM2IHP13-admin%2FJonesForth-arm)
[Notifications](/login?return_to=%2FM2IHP13-admin%2FJonesForth-arm) You must be signed in to change notification settings
* [Code](/M2IHP13-admin/JonesForth-arm)
* [Issues
0](/M2IHP13-admin/JonesForth-arm/issues)
* [Pull requests
0](/M2IHP13-admin/JonesForth-arm/pulls)
* [Actions](/M2IHP13-admin/JonesForth-arm/actions)
* [Projects
0](/M2IHP13-admin/JonesForth-arm/projects)
* [Wiki](/M2IHP13-admin/JonesForth-arm/wiki)
* [Security
0](/M2IHP13-admin/JonesForth-arm/security)
* [Insights](/M2IHP13-admin/JonesForth-arm/pulse)
Additional navigation options
* [Code](/M2IHP13-admin/JonesForth-arm)
* [Issues](/M2IHP13-admin/JonesForth-arm/issues)
* [Pull requests](/M2IHP13-admin/JonesForth-arm/pulls)
* [Actions](/M2IHP13-admin/JonesForth-arm/actions)
* [Projects](/M2IHP13-admin/JonesForth-arm/projects)
* [Wiki](/M2IHP13-admin/JonesForth-arm/wiki)
* [Security](/M2IHP13-admin/JonesForth-arm/security)
* [Insights](/M2IHP13-admin/JonesForth-arm/pulse)
# M2IHP13-admin/JonesForth-arm
master
[Branches](/M2IHP13-admin/JonesForth-arm/branches)[Tags](/M2IHP13-admin/JonesForth-arm/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[58 Commits](/M2IHP13-admin/JonesForth-arm/commits/master/) 58 Commits | | |
| [.gitattributes](/M2IHP13-admin/JonesForth-arm/blob/master/.gitattributes ".gitattributes") | | [.gitattributes](/M2IHP13-admin/JonesForth-arm/blob/master/.gitattributes ".gitattributes") | | |
| [AUTHORS](/M2IHP13-admin/JonesForth-arm/blob/master/AUTHORS "AUTHORS") | | [AUTHORS](/M2IHP13-admin/JonesForth-arm/blob/master/AUTHORS "AUTHORS") | | |
| [LICENSE](/M2IHP13-admin/JonesForth-arm/blob/master/LICENSE "LICENSE") | | [LICENSE](/M2IHP13-admin/JonesForth-arm/blob/master/LICENSE "LICENSE") | | |
| [Makefile](/M2IHP13-admin/JonesForth-arm/blob/master/Makefile "Makefile") | | [Makefile](/M2IHP13-admin/JonesForth-arm/blob/master/Makefile "Makefile") | | |
| [README.md](/M2IHP13-admin/JonesForth-arm/blob/master/README.md "README.md") | | [README.md](/M2IHP13-admin/JonesForth-arm/blob/master/README.md "README.md") | | |
| [jonesforth.S](/M2IHP13-admin/JonesForth-arm/blob/master/jonesforth.S "jonesforth.S") | | [jonesforth.S](/M2IHP13-admin/JonesForth-arm/blob/master/jonesforth.S "jonesforth.S") | | |
| [jonesforth.f](/M2IHP13-admin/JonesForth-arm/blob/master/jonesforth.f "jonesforth.f") | | [jonesforth.f](/M2IHP13-admin/JonesForth-arm/blob/master/jonesforth.f "jonesforth.f") | | |
| [perf\_dupdrop.c](/M2IHP13-admin/JonesForth-arm/blob/master/perf_dupdrop.c "perf_dupdrop.c") | | [perf\_dupdrop.c](/M2IHP13-admin/JonesForth-arm/blob/master/perf_dupdrop.c "perf_dupdrop.c") | | |
| [perf\_dupdrop.f](/M2IHP13-admin/JonesForth-arm/blob/master/perf_dupdrop.f "perf_dupdrop.f") | | [perf\_dupdrop.f](/M2IHP13-admin/JonesForth-arm/blob/master/perf_dupdrop.f "perf_dupdrop.f") | | |
| [test\_comparison.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_comparison.f "test_comparison.f") | | [test\_comparison.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_comparison.f "test_comparison.f") | | |
| [test\_comparison.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_comparison.f.out "test_comparison.f.out") | | [test\_comparison.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_comparison.f.out "test_comparison.f.out") | | |
| [test\_exception.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_exception.f "test_exception.f") | | [test\_exception.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_exception.f "test_exception.f") | | |
| [test\_exception.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_exception.f.out "test_exception.f.out") | | [test\_exception.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_exception.f.out "test_exception.f.out") | | |
| [test\_nqueens.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_nqueens.f "test_nqueens.f") | | [test\_nqueens.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_nqueens.f "test_nqueens.f") | | |
| [test\_nqueens.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_nqueens.f.out "test_nqueens.f.out") | | [test\_nqueens.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_nqueens.f.out "test_nqueens.f.out") | | |
| [test\_number.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_number.f "test_number.f") | | [test\_number.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_number.f "test_number.f") | | |
| [test\_number.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_number.f.out "test_number.f.out") | | [test\_number.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_number.f.out "test_number.f.out") | | |
| [test\_read\_file.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_read_file.f "test_read_file.f") | | [test\_read\_file.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_read_file.f "test_read_file.f") | | |
| [test\_read\_file.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_read_file.f.out "test_read_file.f.out") | | [test\_read\_file.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_read_file.f.out "test_read_file.f.out") | | |
| [test\_stack.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_stack.f "test_stack.f") | | [test\_stack.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_stack.f "test_stack.f") | | |
| [test\_stack.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_stack.f.out "test_stack.f.out") | | [test\_stack.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_stack.f.out "test_stack.f.out") | | |
| [test\_stack\_trace.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_stack_trace.f "test_stack_trace.f") | | [test\_stack\_trace.f](/M2IHP13-admin/JonesForth-arm/blob/master/test_stack_trace.f "test_stack_trace.f") | | |
| [test\_stack\_trace.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_stack_trace.f.out "test_stack_trace.f.out") | | [test\_stack\_trace.f.out](/M2IHP13-admin/JonesForth-arm/blob/master/test_stack_trace.f.out "test_stack_trace.f.out") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [LGPL-3.0 license](#)
# Jonesforth-ARM
An ARM port of X86 JonesForth by Richard W.M. Jones [rich@annexia.org](mailto:rich@annexia.org)
at <http://annexia.org/forth>.
## What is this ?
Jonesforth-ARM is a Forth interpreter developed for ARM.
The algorithm for our unsigned DIVMOD instruction is extracted from 'ARM
Software Development Toolkit User Guide v2.50' published by ARM in 1997-1998
Compared to the original interpreter:
* We did not keep the jonesforth.f section allowing to compile assembly from
the Forth interpreter because it was X86 specific.
* We pass all the original JonesForth's tests on ARM (except one which
depends on the above X86 assembly compilation).
* We added a native signed DIVMOD instruction (S/MOD)
Another project porting Jonesforth on ARM is ongoing at
<https://github.com/phf/forth>
## Build and run instructions
If you are building on the ARM target, just type,
```
$ make
```
to build the forth interpreter.
After building, we recommend that you run the test-suite by executing,
```
$ make test
```
To launch the forth interpreter, type
```
$ cat jonesforth.f - | ./jonesforth
```
## Contributors:
ABECASSIS Felix, BISPO VIEIRA Ricardo, BLANC Benjamin, BORDESSOULES Arthur,
BOUDJEMAI Yassine, BRICAGE Marie, ETSCHMANN Marc, GAYE Ndeye Aram,
GONCALVES Thomas, GOUGEAUD Sebastien, HAINE Christopher, OLIVEIRA Pablo,
PLAZA ONATE Florian, POPOV Mihail
## About
No description, website, or topics provided.
### Resources
[Readme](#readme-ov-file)
### License
[LGPL-3.0 license](#LGPL-3.0-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/M2IHP13-admin/JonesForth-arm/activity)
### Stars
[**89**
stars](/M2IHP13-admin/JonesForth-arm/stargazers)
### Watchers
[**14**
watching](/M2IHP13-admin/JonesForth-arm/watchers)
### Forks
[**52**
forks](/M2IHP13-admin/JonesForth-arm/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2FM2IHP13-admin%2FJonesForth-arm&report=M2IHP13-admin+%28user%29)
## [Releases](/M2IHP13-admin/JonesForth-arm/releases)
No releases published
## [Packages 0](/users/M2IHP13-admin/packages?repo_name=JonesForth-arm)
No packages published
## [Contributors 4](/M2IHP13-admin/JonesForth-arm/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [Forth
62.4%](/M2IHP13-admin/JonesForth-arm/search?l=forth)
* [Assembly
35.9%](/M2IHP13-admin/JonesForth-arm/search?l=assembly)
* Other
1.7%
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,68 @@
# Jonesforth.git
**Source:** http://git.annexia.org/?p=jonesforth.git;a=summary
xml version="1.0" encoding="utf-8"?
annexia.org >> repositories - jonesforth.git/summary
[![git](static/git-logo.png)](http://git-scm.com/ "git homepage")[git.annexia.org](http://git.annexia.org/) / [jonesforth.git](/?p=jonesforth.git;a=summary) / summary
commit
grep
author
committer
pickaxe
[?](/?p=jonesforth.git;a=search_help) search:
re
summary | [shortlog](/?p=jonesforth.git;a=shortlog) | [log](/?p=jonesforth.git;a=log) | [commit](/?p=jonesforth.git;a=commit;h=66c56998125f3ac265a3a1df9821fd52cfeee8cc) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=66c56998125f3ac265a3a1df9821fd52cfeee8cc) | [tree](/?p=jonesforth.git;a=tree)
| | |
| --- | --- |
| description | JONESFORTH - A sometimes minimal FORTH compiler and tutorial |
| owner | |
| last change | Fri, 11 Sep 2009 08:33:13 +0000 (08:33 +0000) |
| URL | git://git.annexia.org/jonesforth.git |
[shortlog](/?p=jonesforth.git;a=shortlog)
| | | | |
| --- | --- | --- | --- |
| *2009-09-11* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Version 47](/?p=jonesforth.git;a=commit;h=66c56998125f3ac265a3a1df9821fd52cfeee8cc) [master](/?p=jonesforth.git;a=shortlog;h=refs/heads/master) | [commit](/?p=jonesforth.git;a=commit;h=66c56998125f3ac265a3a1df9821fd52cfeee8cc) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=66c56998125f3ac265a3a1df9821fd52cfeee8cc) | [tree](/?p=jonesforth.git;a=tree;h=66c56998125f3ac265a3a1df9821fd52cfeee8cc;hb=66c56998125f3ac265a3a1df9821fd52cfeee8cc) | [snapshot](/?p=jonesforth.git;a=snapshot;h=66c56998125f3ac265a3a1df9821fd52cfeee8cc;sf=tgz "in format: tar.gz") |
| *2009-09-11* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Fix ROT/-ROT (Ian Osgood).](/?p=jonesforth.git;a=commit;h=dccbff0e169d5467a78be5c6d935fa505f6a029f) | [commit](/?p=jonesforth.git;a=commit;h=dccbff0e169d5467a78be5c6d935fa505f6a029f) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=dccbff0e169d5467a78be5c6d935fa505f6a029f) | [tree](/?p=jonesforth.git;a=tree;h=dccbff0e169d5467a78be5c6d935fa505f6a029f;hb=dccbff0e169d5467a78be5c6d935fa505f6a029f) | [snapshot](/?p=jonesforth.git;a=snapshot;h=dccbff0e169d5467a78be5c6d935fa505f6a029f;sf=tgz "in format: tar.gz") |
| *2007-10-22* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Fix test\_read\_file so it reads its own output (which...](/?p=jonesforth.git;a=commit;h=092aa5189f24fbfb1714c1d2d31c26a666102c3c "Fix test_read_file so it reads its own output (which should obviously") | [commit](/?p=jonesforth.git;a=commit;h=092aa5189f24fbfb1714c1d2d31c26a666102c3c) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=092aa5189f24fbfb1714c1d2d31c26a666102c3c) | [tree](/?p=jonesforth.git;a=tree;h=092aa5189f24fbfb1714c1d2d31c26a666102c3c;hb=092aa5189f24fbfb1714c1d2d31c26a666102c3c) | [snapshot](/?p=jonesforth.git;a=snapshot;h=092aa5189f24fbfb1714c1d2d31c26a666102c3c;sf=tgz "in format: tar.gz") |
| *2007-10-12* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Documentation.](/?p=jonesforth.git;a=commit;h=c089529de15a934abb14f8e9b0aa5ef08e6edd00) | [commit](/?p=jonesforth.git;a=commit;h=c089529de15a934abb14f8e9b0aa5ef08e6edd00) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=c089529de15a934abb14f8e9b0aa5ef08e6edd00) | [tree](/?p=jonesforth.git;a=tree;h=c089529de15a934abb14f8e9b0aa5ef08e6edd00;hb=c089529de15a934abb14f8e9b0aa5ef08e6edd00) | [snapshot](/?p=jonesforth.git;a=snapshot;h=c089529de15a934abb14f8e9b0aa5ef08e6edd00;sf=tgz "in format: tar.gz") |
| *2007-10-12* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Fix perf\_dupdrop forth test.](/?p=jonesforth.git;a=commit;h=cea392870a443a3d773d18d1627fa94712387cf5) | [commit](/?p=jonesforth.git;a=commit;h=cea392870a443a3d773d18d1627fa94712387cf5) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=cea392870a443a3d773d18d1627fa94712387cf5) | [tree](/?p=jonesforth.git;a=tree;h=cea392870a443a3d773d18d1627fa94712387cf5;hb=cea392870a443a3d773d18d1627fa94712387cf5) | [snapshot](/?p=jonesforth.git;a=snapshot;h=cea392870a443a3d773d18d1627fa94712387cf5;sf=tgz "in format: tar.gz") |
| *2007-10-12* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Tip on dumping out the latest word.](/?p=jonesforth.git;a=commit;h=a9bb8b18891404c2fd315f2fc5cbeaf6c25e9b43) | [commit](/?p=jonesforth.git;a=commit;h=a9bb8b18891404c2fd315f2fc5cbeaf6c25e9b43) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=a9bb8b18891404c2fd315f2fc5cbeaf6c25e9b43) | [tree](/?p=jonesforth.git;a=tree;h=a9bb8b18891404c2fd315f2fc5cbeaf6c25e9b43;hb=a9bb8b18891404c2fd315f2fc5cbeaf6c25e9b43) | [snapshot](/?p=jonesforth.git;a=snapshot;h=a9bb8b18891404c2fd315f2fc5cbeaf6c25e9b43;sf=tgz "in format: tar.gz") |
| *2007-10-11* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Wrote code to do performance comparisons.](/?p=jonesforth.git;a=commit;h=aa173d5f30ea45f0c06799c858c4a91681cf0cf7) | [commit](/?p=jonesforth.git;a=commit;h=aa173d5f30ea45f0c06799c858c4a91681cf0cf7) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=aa173d5f30ea45f0c06799c858c4a91681cf0cf7) | [tree](/?p=jonesforth.git;a=tree;h=aa173d5f30ea45f0c06799c858c4a91681cf0cf7;hb=aa173d5f30ea45f0c06799c858c4a91681cf0cf7) | [snapshot](/?p=jonesforth.git;a=snapshot;h=aa173d5f30ea45f0c06799c858c4a91681cf0cf7;sf=tgz "in format: tar.gz") |
| *2007-10-11* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Test assembler & INLINE](/?p=jonesforth.git;a=commit;h=f8688e0ca6ee2928ae1441ba2b7f5d2c8f43dea5) | [commit](/?p=jonesforth.git;a=commit;h=f8688e0ca6ee2928ae1441ba2b7f5d2c8f43dea5) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=f8688e0ca6ee2928ae1441ba2b7f5d2c8f43dea5) | [tree](/?p=jonesforth.git;a=tree;h=f8688e0ca6ee2928ae1441ba2b7f5d2c8f43dea5;hb=f8688e0ca6ee2928ae1441ba2b7f5d2c8f43dea5) | [snapshot](/?p=jonesforth.git;a=snapshot;h=f8688e0ca6ee2928ae1441ba2b7f5d2c8f43dea5;sf=tgz "in format: tar.gz") |
| *2007-10-11* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Basic stack tests](/?p=jonesforth.git;a=commit;h=a28fd94bb9711f62659bc89a275af9eb7134bece) | [commit](/?p=jonesforth.git;a=commit;h=a28fd94bb9711f62659bc89a275af9eb7134bece) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=a28fd94bb9711f62659bc89a275af9eb7134bece) | [tree](/?p=jonesforth.git;a=tree;h=a28fd94bb9711f62659bc89a275af9eb7134bece;hb=a28fd94bb9711f62659bc89a275af9eb7134bece) | [snapshot](/?p=jonesforth.git;a=snapshot;h=a28fd94bb9711f62659bc89a275af9eb7134bece;sf=tgz "in format: tar.gz") |
| *2007-10-11* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [INLINE assembly](/?p=jonesforth.git;a=commit;h=ac014bc0a927ca7ab4177636056fd267384a8f47) | [commit](/?p=jonesforth.git;a=commit;h=ac014bc0a927ca7ab4177636056fd267384a8f47) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=ac014bc0a927ca7ab4177636056fd267384a8f47) | [tree](/?p=jonesforth.git;a=tree;h=ac014bc0a927ca7ab4177636056fd267384a8f47;hb=ac014bc0a927ca7ab4177636056fd267384a8f47) | [snapshot](/?p=jonesforth.git;a=snapshot;h=ac014bc0a927ca7ab4177636056fd267384a8f47;sf=tgz "in format: tar.gz") |
| *2007-10-11* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Implement 2DROP, 2DUP, 2SWAP as asm primitives.](/?p=jonesforth.git;a=commit;h=ae7508776fa28d069e0d890e6878f09a8e3f05ee) | [commit](/?p=jonesforth.git;a=commit;h=ae7508776fa28d069e0d890e6878f09a8e3f05ee) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=ae7508776fa28d069e0d890e6878f09a8e3f05ee) | [tree](/?p=jonesforth.git;a=tree;h=ae7508776fa28d069e0d890e6878f09a8e3f05ee;hb=ae7508776fa28d069e0d890e6878f09a8e3f05ee) | [snapshot](/?p=jonesforth.git;a=snapshot;h=ae7508776fa28d069e0d890e6878f09a8e3f05ee;sf=tgz "in format: tar.gz") |
| *2007-10-10* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Assembly code.](/?p=jonesforth.git;a=commit;h=465979550d58288f6bee28c49064d9c841a6f45f) | [commit](/?p=jonesforth.git;a=commit;h=465979550d58288f6bee28c49064d9c841a6f45f) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=465979550d58288f6bee28c49064d9c841a6f45f) | [tree](/?p=jonesforth.git;a=tree;h=465979550d58288f6bee28c49064d9c841a6f45f;hb=465979550d58288f6bee28c49064d9c841a6f45f) | [snapshot](/?p=jonesforth.git;a=snapshot;h=465979550d58288f6bee28c49064d9c841a6f45f;sf=tgz "in format: tar.gz") |
| *2007-10-07* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Restructure Makefile to add automated tests.](/?p=jonesforth.git;a=commit;h=83c6612bf07228f70d25136c850f660721379632) | [commit](/?p=jonesforth.git;a=commit;h=83c6612bf07228f70d25136c850f660721379632) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=83c6612bf07228f70d25136c850f660721379632) | [tree](/?p=jonesforth.git;a=tree;h=83c6612bf07228f70d25136c850f660721379632;hb=83c6612bf07228f70d25136c850f660721379632) | [snapshot](/?p=jonesforth.git;a=snapshot;h=83c6612bf07228f70d25136c850f660721379632;sf=tgz "in format: tar.gz") |
| *2007-09-30* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Fix CLOSE](/?p=jonesforth.git;a=commit;h=bedb4b2f3f229eb41f7eb6af84aff5d1d660c805) | [commit](/?p=jonesforth.git;a=commit;h=bedb4b2f3f229eb41f7eb6af84aff5d1d660c805) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=bedb4b2f3f229eb41f7eb6af84aff5d1d660c805) | [tree](/?p=jonesforth.git;a=tree;h=bedb4b2f3f229eb41f7eb6af84aff5d1d660c805;hb=bedb4b2f3f229eb41f7eb6af84aff5d1d660c805) | [snapshot](/?p=jonesforth.git;a=snapshot;h=bedb4b2f3f229eb41f7eb6af84aff5d1d660c805;sf=tgz "in format: tar.gz") |
| *2007-09-29* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | ['SPACE' -> BL (standard FORTH word)](/?p=jonesforth.git;a=commit;h=912d572e049973aac0dd5ae44c81944a76236883) | [commit](/?p=jonesforth.git;a=commit;h=912d572e049973aac0dd5ae44c81944a76236883) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=912d572e049973aac0dd5ae44c81944a76236883) | [tree](/?p=jonesforth.git;a=tree;h=912d572e049973aac0dd5ae44c81944a76236883;hb=912d572e049973aac0dd5ae44c81944a76236883) | [snapshot](/?p=jonesforth.git;a=snapshot;h=912d572e049973aac0dd5ae44c81944a76236883;sf=tgz "in format: tar.gz") |
| *2007-09-29* | [rich](/?p=jonesforth.git;a=search;s=rich;st=author "Search for commits authored by rich") | [Added O\_\* constants for open(2) syscall](/?p=jonesforth.git;a=commit;h=abcbc5d578daa147d957f9e3c5874690ae779328) | [commit](/?p=jonesforth.git;a=commit;h=abcbc5d578daa147d957f9e3c5874690ae779328) | [commitdiff](/?p=jonesforth.git;a=commitdiff;h=abcbc5d578daa147d957f9e3c5874690ae779328) | [tree](/?p=jonesforth.git;a=tree;h=abcbc5d578daa147d957f9e3c5874690ae779328;hb=abcbc5d578daa147d957f9e3c5874690ae779328) | [snapshot](/?p=jonesforth.git;a=snapshot;h=abcbc5d578daa147d957f9e3c5874690ae779328;sf=tgz "in format: tar.gz") |
| [...](/?p=jonesforth.git;a=shortlog) | | | |
[heads](/?p=jonesforth.git;a=heads)
| | | |
| --- | --- | --- |
| *16 years ago* | [master](/?p=jonesforth.git;a=shortlog;h=refs/heads/master) | [shortlog](/?p=jonesforth.git;a=shortlog;h=refs/heads/master) | [log](/?p=jonesforth.git;a=log;h=refs/heads/master) | [tree](/?p=jonesforth.git;a=tree;h=refs/heads/master;hb=refs/heads/master) |
JONESFORTH - A sometimes minimal FORTH compiler and tutorial
[RSS](/?p=jonesforth.git;a=rss "log RSS feed")
[Atom](/?p=jonesforth.git;a=atom "log Atom feed")

View File

@@ -0,0 +1,195 @@
# Literals, ifs, and loops
**Source:** https://muforth.dev/threaded-code-literals-ifs-and-loops/
Threaded code: Literals, ifs, and loops muforth
# Threaded code: Literals, ifs, and loops
---
While writing my [introduction to threaded code](/threaded-code/) I suggested that non-leaf routines colon words, in Forth lingo can be represented as a list of addresses that get executed in sequence. This suggested that all code executes in a straight line and then returns to its caller. We all know this isnt true, but threaded code that runs in a straight line is already tricky and tedious to explain; explaining literals and control structures at the same time seemed like too much.
But we are here now, and we understand how threading-in-a-straight-line works, so lets see how loops, branches, and literals work in a threaded world.
---
In the real world, code doesnt always execute in a straight line and then return and yet, at the moment, which the machinery that weve defined so far, thats all we can do. We also have no way to represent literal data addresses or numbers that we might want to compute with. We can write a code word called `+` that pops two values off the data stack, adds them, and pushes the result, but if we want to add 8 to something, how do we do that?
With just three runtime code words we can add if/then/else, while loops, and literals to our system.
The names are arbitrary, but in many Forth systems the convention is to give them parenthesized names. These are not words that mere mortals normally execute; they exist as part of the hidden “runtime fabric” of the system. The parentheses suggest their “underlying” or “runtime” nature.
Here they are:
```
(lit) Fetch into W the address pointed to by IP
Increment IP by address size (skip literal)
Push W onto the data stack
Execute NEXT
```
```
(branch) Fetch into W the address pointed to by IP
Set IP to W
Execute NEXT
```
```
(0branch) Pop a value off the data stack
If the value is zero, execute (branch)
Otherwise, increment IP by address size (skip branch address)
```
The `(branch)` above does an *absolute* branch. If you prefer relative branches, modify it thus:
```
(branch) Fetch into W the address pointed to by IP
Set IP to IP + W
Execute NEXT
```
Lets assume we have a code word `+` that adds two values. To create a word that adds 8 to whatever is on the top of the stack, we would create a colon word with the following (textual) definition:
```
: add8 8 + ;
```
which, assuming an ITC system, would get compiled to:
```
add8
~~~~
address of NEST ( all colon words start with this)
address of (lit)
8
address of +
address of UNNEST
```
The `;` adds the address of UNNEST at the end and ends the compilation.
(This is getting outside the scope of our discussion, which is about the *execution machinery*, but in Forth systems `;` has *two* tasks: to compile the address of UNNEST, and to exit “compilation mode” a special mode of *textual* interpretation that is the essence of the Forth compiler and return to normal “interpretation” mode.)
For if/then/else and looping we use *flag* values truth values that we compute and leave on the stack for `(0branch)` to test and consume.
To make this even more concrete, lets add five more code words to our system:
```
< Pop two values off the data stack
If the first is less than the second, push -1
Otherwise, push 0
Execute NEXT
```
```
0= Pop a value off the data stack
If the value is zero, push -1
Otherwise, push 0
Execute NEXT
```
```
dup Pop a value off the data stack
Push it back onto data stack
Push it a second time
Execute NEXT
```
```
2dup Pop two values off the data stack
Push them back onto data stack, in the same order
Push them a second time, also in the same order
Execute NEXT
```
```
swap Pop two values off the data stack
Push them back onto data stack, in the reverse order
Execute NEXT
```
In many Forth systems -1 is the preferred “true” value because it is represented (on almost all machines!!) by an all-ones bit pattern, which can be logically ANDed with other values... but we digress. ;-)
From our definition of `(0branch)` above it should be clear that *any* non-zero value is true, and only zero is false.
Lets write a simple loop. (There is a better, more efficient, and more idiomatic way to do this, but it is outside the scope of this example. ;-)
```
-8 begin 1 + dup 0= until
```
This will get compiled to the following “address list”:
```
00 address of (lit)
04 -8
08 address of (lit)
0c 1
10 address of +
14 address of dup
18 address of 0=
1c address of (0branch)
20 08
24 ...
```
We have to `dup` the value before we test it with `0=` because `0=` *consumes* the value before pushing its true or false flag.
The word `begin` compiles no code; it “marks” the location that `(0branch)` later branches back to.
Ive added memory addresses in hex (which assume a byte-addressed machine with 32-bit addresses) to make the branch destination easier to describe.
We write if/then like this:
```
2dup < if swap then
```
This compiles to the following:
```
00 address of 2dup
04 address of <
08 address of (0branch)
0c 1c
10 address of swap
1c ...
```
As before, we `2dup` the values because `<` consumes them.
Like `begin`, `then` compiles no code; it resolves the forward branch that `if` compiled. Words like if, then, begin, and until are called *compiling* words because they execute at compile time and do something special, like resolve a forward or backward branch address.
Adding an `else` clause looks like this:
```
0= if 4 else 8 then +
```
This code compiles to:
```
00 address of 0=
04 address of (0branch)
08 1c
0c address of (lit)
10 4
14 address of (branch)
18 24
1c address of (lit)
20 8
24 address of +
28 ...
```
`if` compiles the `(0branch)`, `else` compiles the `(branch)` and resolves the forward `(0branch)`, and `then` resolves the forward `(branch)`.
Remember: `(0branch)` means branch if *false*.
---
[Send feedback](/cdn-cgi/l/email-protection#ba9f8d8d9f8c8f9f8c889f8c829f8c8b9f8cde9f8d899f8d8e9f8c8f9f8d889f8e8a9f8cdf9f8c839f8cde9f8c889f8cd99f8c8f9f8cde9f8c8b9f8c899f8c829f8c839f8cdf9f8c8f9f8d899f88df9f8c899f8cdc9f8cde85c9cfd8d0dfd9ce879f8fd8d7cfdcd5c8ced29f8fde9f888aeed2c8dfdbdedfde9f888ad9d5dedf9f89db9f888af6d3cedfc8dbd6c99f88d99f888ad3dcc99f88d99f888adbd4de9f888ad6d5d5cac9) on this page (last edited 2017 May 01)
Browse [all pages](/all-pages/)
Return [home](/)

View File

@@ -0,0 +1,621 @@
# MiniForth
**Source:** https://github.com/ttsiodras/MiniForth
GitHub - ttsiodras/MiniForth: A tiny Forth I built in a week. Blog post: https://www.thanassis.space/miniforth.html
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fttsiodras%2FMiniForth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fttsiodras%2FMiniForth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=ttsiodras%2FMiniForth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[ttsiodras](/ttsiodras)
/
**[MiniForth](/ttsiodras/MiniForth)**
Public
* [Notifications](/login?return_to=%2Fttsiodras%2FMiniForth) You must be signed in to change notification settings
* [Fork
7](/login?return_to=%2Fttsiodras%2FMiniForth)
* [Star
95](/login?return_to=%2Fttsiodras%2FMiniForth)
A tiny Forth I built in a week. Blog post: <https://www.thanassis.space/miniforth.html>
### License
[MIT license](/ttsiodras/MiniForth/blob/master/LICENSE)
[95
stars](/ttsiodras/MiniForth/stargazers) [7
forks](/ttsiodras/MiniForth/forks) [Branches](/ttsiodras/MiniForth/branches) [Tags](/ttsiodras/MiniForth/tags) [Activity](/ttsiodras/MiniForth/activity)
[Star](/login?return_to=%2Fttsiodras%2FMiniForth)
[Notifications](/login?return_to=%2Fttsiodras%2FMiniForth) You must be signed in to change notification settings
* [Code](/ttsiodras/MiniForth)
* [Issues
0](/ttsiodras/MiniForth/issues)
* [Pull requests
0](/ttsiodras/MiniForth/pulls)
* [Actions](/ttsiodras/MiniForth/actions)
* [Projects
0](/ttsiodras/MiniForth/projects)
* [Security
0](/ttsiodras/MiniForth/security)
* [Insights](/ttsiodras/MiniForth/pulse)
Additional navigation options
* [Code](/ttsiodras/MiniForth)
* [Issues](/ttsiodras/MiniForth/issues)
* [Pull requests](/ttsiodras/MiniForth/pulls)
* [Actions](/ttsiodras/MiniForth/actions)
* [Projects](/ttsiodras/MiniForth/projects)
* [Security](/ttsiodras/MiniForth/security)
* [Insights](/ttsiodras/MiniForth/pulse)
# ttsiodras/MiniForth
master
[Branches](/ttsiodras/MiniForth/branches)[Tags](/ttsiodras/MiniForth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[41 Commits](/ttsiodras/MiniForth/commits/master/) 41 Commits | | |
| [contrib](/ttsiodras/MiniForth/tree/master/contrib "contrib") | | [contrib](/ttsiodras/MiniForth/tree/master/contrib "contrib") | | |
| [simavr @ a56b550](/buserror/simavr/tree/a56b550872906a971ac128002772d90c9e30377d "simavr") | | [simavr @ a56b550](/buserror/simavr/tree/a56b550872906a971ac128002772d90c9e30377d "simavr") | | |
| [src](/ttsiodras/MiniForth/tree/master/src "src") | | [src](/ttsiodras/MiniForth/tree/master/src "src") | | |
| [src\_x86](/ttsiodras/MiniForth/tree/master/src_x86 "src_x86") | | [src\_x86](/ttsiodras/MiniForth/tree/master/src_x86 "src_x86") | | |
| [testing](/ttsiodras/MiniForth/tree/master/testing "testing") | | [testing](/ttsiodras/MiniForth/tree/master/testing "testing") | | |
| [.gitignore](/ttsiodras/MiniForth/blob/master/.gitignore ".gitignore") | | [.gitignore](/ttsiodras/MiniForth/blob/master/.gitignore ".gitignore") | | |
| [.gitmodules](/ttsiodras/MiniForth/blob/master/.gitmodules ".gitmodules") | | [.gitmodules](/ttsiodras/MiniForth/blob/master/.gitmodules ".gitmodules") | | |
| [LICENSE](/ttsiodras/MiniForth/blob/master/LICENSE "LICENSE") | | [LICENSE](/ttsiodras/MiniForth/blob/master/LICENSE "LICENSE") | | |
| [Makefile](/ttsiodras/MiniForth/blob/master/Makefile "Makefile") | | [Makefile](/ttsiodras/MiniForth/blob/master/Makefile "Makefile") | | |
| [README.md](/ttsiodras/MiniForth/blob/master/README.md "README.md") | | [README.md](/ttsiodras/MiniForth/blob/master/README.md "README.md") | | |
| [config.mk](/ttsiodras/MiniForth/blob/master/config.mk "config.mk") | | [config.mk](/ttsiodras/MiniForth/blob/master/config.mk "config.mk") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [MIT license](#)
*( Wrote [a blog post about this here](https://www.thanassis.space/miniforth.html) )*
It was raining hard, a week ago.
And what could you possibly do on a rainy Saturday afternoon?
Well...
You can make a Forth interpreter/compiler from scratch...
...then put it inside a 1.5$ Blue Pill microcontroller...
...and finally, inside an Arduino UNO...
... within its tiny 2K RAM!
Click on the image to watch it blinking the LED of my Arduino:
[![Here's a video of it action, blinking my Arduino :-)](https://camo.githubusercontent.com/10dcc45a92a8eb1fbc79bbcf7127dea99324e316bf5b5ce1bd0515f9c86e5da5/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f7865506f6c6c62437a6f772f302e6a7067)](https://www.youtube.com/watch?v=xePollbCzow)
I haven't done anything even *remotely* close to this in decades...
I *loved* building it.
The rainy afternoon turned into a week-long hackfest *(was looking
forward every day to the post-work FORTH-tinkering in the afternoon...)*
The result: a tiny, mini, micro Forth. In portable C++ :-)
It has...
* basic arithmetic
* star-slash (double-word accurate muldiv)
* literals
* constants
* variables
* direct memory access
* string printing
* reseting
* comments
* nested DO/LOOP
* comparisons
* nested IF/ELSE/THEN
* ...and of course, functions (Forth words)
Here's an ascii-cast recording of it in action:
[![Recording of building and uploading on an Arduino UNO](https://camo.githubusercontent.com/429594b830bb91d714d4beb75bd9684a0108521b63c4a5669fa2ce955d2b396d/68747470733a2f2f61736369696e656d612e6f72672f612f3432333634392e737667)](https://asciinema.org/a/423649?autoplay=1)
Read the test scenario below to see my supported Forth constructs.
# Portability, ArduinoSTL and Valgrind/AddressSanitizer checks
I meant it when I said "portable". Part of my reasoning was, that
in addition to targeting multiple platforms (e.g. BluePill and
Arduino) I wanted to be able to use Valgrind and AddressSanitizer
to detect - in the host! - any issues I have with my memory handling.
Since I had embedded targets in mind, I tried ArduinoSTL - but it was too
wasteful memory-wise. It also made the build process significantly slower.
I therefore built my own [memory pool, as well as list, tuple and string-like
C++ templates](https://github.com/ttsiodras/MiniForth/tree/master/src/mini_stl.h). It was a nice challenge, re-inventing a tiny C++ STL...
And I understand STL a lot better now, after building small pieces of it myself :-)
# Simulation / Debugging
I setup simulation via [simavr](https://github.com/buserror/simavr.git).
This tremendously improved my developing speed, since a simulator
spawns and runs much faster than the real board. Due to the code
being portable, debugging took place mostly in the host GDB;
and after Valgrind and AddressSanitizer gave their blessing, I usually
found out that the simulator (and the real board) worked fine as well.
# BluePill vs Arduino UNO
Thanks to ArduinoSTL, I quickly reached the point of running inside the
BluePill. The 1.5$ mini-monster has 10 times more SRAM than an Arduino UNO;
so in a couple of days, I had a [working branch](https://github.com/ttsiodras/MiniForth/tree/BluePill-STM32F103C).
[![The 1.5$ 'Beast'](/ttsiodras/MiniForth/raw/master/contrib/BluePill.jpg "The 1.5$ 'Beast'")](/ttsiodras/MiniForth/blob/master/contrib/BluePill.jpg)
But as said above, that wasn't nearly enough to make it work in my
Arduino UNO. That required far more work *(see below)*.
As for the BluePill, I should note that, as in all my other embedded targets,
I prefer a development workflow that is based on normal bootloaders
*(not on programmers)*. I therefore burned the
[stm32duino](https://github.com/rogerclarkmelbourne/STM32duino-bootloader)
bootloader on the BluePill, which allowed me to easily program it
in subsequent iterations via the USB connection (and a simple `make upload`).
The same USB connection would then function as a serial port immediately
afterwards - allowing me to interact with the newly uploaded Forth in the
BluePill.
The screenshot below is from a `tmux`: on the left, the output from `make upload`;
and on the right, I used `picocom` to interact with my mini-Forth
over the serial port:
[![Compiling, uploading and testing](/ttsiodras/MiniForth/raw/master/contrib/itworks.jpg "Compiling, uploading and testing")](/ttsiodras/MiniForth/blob/master/contrib/itworks.jpg)
# Memory - the final frontier
That covered the first two days.
But when I tried compiling for the Arduino UNO, I realised that the ArduinoSTL
was not enough. I run out of memory...
So I built my own [mini-STL](https://github.com/ttsiodras/MiniForth/tree/master/src/mini_stl.h),
and tightly controlled *all* memory utilisation.
I also used macro-magic to move all strings to Flash at compile-time
(see `dprintf` in the code)... And saved memory everywhere I could,
re-using error messages across various operations - and storing the
entire array of native operations in Flash.
Nothing flexes your coding muscles as much as optimising; whether it is
for speed or for space. See the implementation of ".S" for example,
where the (obvious) stack reversal code is also the most wasteful...
Changing it to a slower but memory-preserving algorithm allowed me
to use ".S" even when almost all my memory is full.
# C++ vs C
I know that many developers hate C++. I even wrote a
[blog post](https://www.thanassis.space/cpp.html) about it.
And I understand why - they see code like this...
```
#include "mini_stl.h"
template<class T>
typename forward_list<T>::box *forward_list<T>::_freeList = NULL;
```
...and they start screaming - "what the hell is that", "incomprehensible
madness", etc.
But there are very important benefits in using C++ - and templates
in particular. You write less code, with no additional run-time or
memory overhead compared to C, and with a lot more compile-time checks
that watch your back (for things that would otherwise blow up in your face).
See my Optional for example, that emulates (badly) the optional
type of Rust/OCaml/F#/Scala/Kotlin etc. It **forces** you to check
your returned error codes:
```
Optional<int> Forth::needs_a_number(const __FlashStringHelper *msg)
{
if (_stack.empty())
return error(emptyMsgFlash, msg);
auto topVal = *_stack.begin();
if (topVal._kind == StackNode::LIT)
return topVal._u.intVal;
else
return FAILURE;
}
```
You can't "forget" to check the potential for a failure coded inside
your returned value - because your code has to "unwrap" it. I could have
done this better, but I chose to implement it via simple tuples
(this was a one-weeks-afternoons hack, after all :-)
As for the template "magic" incantation above - it *is* true magic: My
`forward_list` template is using free-lists to store the `pop_front`-ed
elements and reuse them in subsequent allocations. I wanted these free-lists to
be global (i.e. static members) because lists of the same type must re-use a
single, commonly-shared free-list. The magic spell tells the compiler I want to
instantiate these globals *once*, for each type T that I use in any
lists in my code.
# My Forth test scenario - including a FizzBuzz!
Yep, FizzBuzz - we are fully Turing complete. And would surely pass
Joel's interview :-)
```
." Reset... " RESET
." Check comments... " \ Yes, we support the new-style comments :-)
." Computing simple addition of 3 + 4... " 3 4 + .
." Is 1 = 2 ?... " 1 2 = .
." Is 1 > 2 ?... " 1 2 > .
." Is 1 < 2 ?... " 1 2 < .
." Define pi at double-word precision... " : pi 355 113 */ ;
." Use definition to compute 10K times PI... " 10000 pi .
." Check: 23 mod 7... " 23 7 MOD .
." Defining 1st level function1... " : x2 2 * ;
." Defining 1st level function2... " : p4 4 + ;
." 2nd level word using both - must print 24... " 10 x2 p4 .
." Defining a variable with value 123... " 123 variable ot3
." Printing variable's value... " ot3 @ .
." Defining The Constant (TM)... " 42 constant lifeUniverse
." Printing The Constant (TM)... " lifeUniverse .
." Setting the variable to The Constant (TM)... " lifeUniverse ot3 !
." Printing variable's value... " ot3 @ .
." Setting the variable to hex 0x11... " $11 ot3 !
." Printing variable's value... " ot3 @ .
." Setting the variable to binary 10100101... " %10100101 ot3 !
." Printing variable's value... " ot3 @ .
." Defining helper... " : p5 5 U.R . ;
." Defining 3 times loop... " : x3lp 3 0 DO I p5 LOOP ;
." Calling loop... " x3lp
." Defining loop calling loop 2 times... " : x6lp 2 0 DO x3lp LOOP ;
." Nested-looping 2x3 times... " x6lp
." Inline: " : m 3 1 DO 3 1 DO CR J p5 I p5 ." = " J I * p5 LOOP LOOP ;
." Use inline loops with two indexes... " m
." Make multiples of 7 via DUP... " : m7s 10 0 DO DUP I * . LOOP DROP ;
." Print them and DROP the 7... " 7 m7s
." Reset... " RESET
\ Time for Turing completeness...
." Let's do Fizz-Buzz! " \ Turing Completeness check...
\ fizz ( n -- 0_or_1 n )
." Define fizz... " : fizz DUP 3 MOD 0 = IF ." fizz " 1 ELSE 0 THEN SWAP ;
\ buzz ( n -- 0_or_1 n )
." Define buzz... " : buzz DUP 5 MOD 0 = IF ." buzz " 1 ELSE 0 THEN SWAP ;
\ emitNum ( 0_or_1 0_or_1 n -- )
." Define emitNum... " : emitNum ROT ROT + 0 = if . ELSE DROP THEN ;
\ mainloop ( n -- )
." Define mainloop... " : mainloop ." ( " fizz buzz emitNum ." ) " ;
\ fb ( -- )
." Define fizzbuzz... " : fb 37 1 DO I mainloop LOOP ;
." Run it! " fb
." Report memory usage... " .S
." All done! "
```
# Automation
I am a strong believer in automation. The final form of my `Makefile`
therefore has many rules - e.g. `make arduino-sim` - that automate
various parts of the workflow.
Here's what they do:
* **arduino**: Compiles the code for Arduino UNO - builds `src/tmp/myforth.ino.{elf,hex}`
* **arduino-sim**: After building, launches the compiled mini-Forth in `simduino`.
* **upload**: After building, uploads to an Arduino attached to the port
configured inside `config.mk`.
* **terminal**: After uploading, launches a `picocom` terminal with
all appropriate settings to interact with my Forth.
* **x86**: Builds for x86. Actually, should easily build for any native target (ARM, etc).
* **test-address-sanitizer**: Uses the x86 binary to test the code, executing
all steps of the scenario shown above. The binary is built with the
address sanitizer enabled (to detect memory issues).
* **test-valgrind**: Same, but with Valgrind.
* **test-simulator**: Spawns `simavr` and sends the entire test scenario shown
above to it - while showing the responses received from it.
* **test-arduino**: Sends the entire test scenario shown above to an
Arduino Uno connected to the port specified in `config.mk`
and shows the responses received over that serial port.
* **blink-arduino**: Sends the "hello word" of the HW world: a tiny
[Forth program](/ttsiodras/MiniForth/blob/master/testing/blinky.fs) blinking the Arduino's LED.
Another example of automation - the complete test scenario shown in the
previous section, is not just an example in the documentation; it is
extracted automatically from this README and fed into the Valgrind and
AddressSanitizer tests... and also into the Python testing script that
sends the data to the board in real-time.
[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), folks.
# Conclusion
I thoroughly enjoyed building this. I know full well that Forths are not
supposed to be built in C++; they are supposed to be built in assembly,
and also, utilise the Flash to store the user-compiled code at run-time.
But that wasn't the point of this - the point was to have fun and learn Forth.
And what better way to learn a language than to actually implement it! :-)
And... as a child of the 80s... I now know first-hand what
[Jupiter Ace](https://en.wikipedia.org/wiki/Jupiter_Ace) was about :-)
Fork the code, and enjoy tinkering with it!
Thanassis.
## About
A tiny Forth I built in a week. Blog post: <https://www.thanassis.space/miniforth.html>
### Topics
[arduino](/topics/arduino "Topic: arduino")
[cpp](/topics/cpp "Topic: cpp")
[forth](/topics/forth "Topic: forth")
### Resources
[Readme](#readme-ov-file)
### License
[MIT license](#MIT-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/ttsiodras/MiniForth/activity)
### Stars
[**95**
stars](/ttsiodras/MiniForth/stargazers)
### Watchers
[**6**
watching](/ttsiodras/MiniForth/watchers)
### Forks
[**7**
forks](/ttsiodras/MiniForth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fttsiodras%2FMiniForth&report=ttsiodras+%28user%29)
## [Releases 2](/ttsiodras/MiniForth/releases)
[Final release - optimal memory/flash use everywhere.
Latest
Jul 9, 2021](/ttsiodras/MiniForth/releases/tag/v1.1)
[+ 1 release](/ttsiodras/MiniForth/releases)
## [Packages 0](/users/ttsiodras/packages?repo_name=MiniForth)
No packages published
## Languages
* [C++
80.5%](/ttsiodras/MiniForth/search?l=c%2B%2B)
* [C
10.9%](/ttsiodras/MiniForth/search?l=c)
* [Makefile
4.9%](/ttsiodras/MiniForth/search?l=makefile)
* [Python
1.5%](/ttsiodras/MiniForth/search?l=python)
* [Shell
1.3%](/ttsiodras/MiniForth/search?l=shell)
* [Forth
0.9%](/ttsiodras/MiniForth/search?l=forth)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,466 @@
# Repo
**Source:** https://github.com/nimblemachines/muforth#under-active-development
GitHub - nimblemachines/muforth: A simple, indirect-threaded Forth, written in C; for target compiling; runs on Linux, BSD, OSX, and Cygwin
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fnimblemachines%2Fmuforth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fnimblemachines%2Fmuforth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=nimblemachines%2Fmuforth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[nimblemachines](/nimblemachines)
/
**[muforth](/nimblemachines/muforth)**
Public
* [Notifications](/login?return_to=%2Fnimblemachines%2Fmuforth) You must be signed in to change notification settings
* [Fork
34](/login?return_to=%2Fnimblemachines%2Fmuforth)
* [Star
153](/login?return_to=%2Fnimblemachines%2Fmuforth)
A simple, indirect-threaded Forth, written in C; for target compiling; runs on Linux, BSD, OSX, and Cygwin
[muforth.dev/](https://muforth.dev/ "https://muforth.dev/")
### License
[View license](/nimblemachines/muforth/blob/master/LICENSE)
[153
stars](/nimblemachines/muforth/stargazers) [34
forks](/nimblemachines/muforth/forks) [Branches](/nimblemachines/muforth/branches) [Tags](/nimblemachines/muforth/tags) [Activity](/nimblemachines/muforth/activity)
[Star](/login?return_to=%2Fnimblemachines%2Fmuforth)
[Notifications](/login?return_to=%2Fnimblemachines%2Fmuforth) You must be signed in to change notification settings
* [Code](/nimblemachines/muforth)
* [Issues
17](/nimblemachines/muforth/issues)
* [Pull requests
1](/nimblemachines/muforth/pulls)
* [Actions](/nimblemachines/muforth/actions)
* [Projects
0](/nimblemachines/muforth/projects)
* [Security
0](/nimblemachines/muforth/security)
* [Insights](/nimblemachines/muforth/pulse)
Additional navigation options
* [Code](/nimblemachines/muforth)
* [Issues](/nimblemachines/muforth/issues)
* [Pull requests](/nimblemachines/muforth/pulls)
* [Actions](/nimblemachines/muforth/actions)
* [Projects](/nimblemachines/muforth/projects)
* [Security](/nimblemachines/muforth/security)
* [Insights](/nimblemachines/muforth/pulse)
# nimblemachines/muforth
master
[Branches](/nimblemachines/muforth/branches)[Tags](/nimblemachines/muforth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[3,159 Commits](/nimblemachines/muforth/commits/master/) 3,159 Commits | | |
| [.vim](/nimblemachines/muforth/tree/master/.vim ".vim") | | [.vim](/nimblemachines/muforth/tree/master/.vim ".vim") | | |
| [doc](/nimblemachines/muforth/tree/master/doc "doc") | | [doc](/nimblemachines/muforth/tree/master/doc "doc") | | |
| [mu](/nimblemachines/muforth/tree/master/mu "mu") | | [mu](/nimblemachines/muforth/tree/master/mu "mu") | | |
| [scripts](/nimblemachines/muforth/tree/master/scripts "scripts") | | [scripts](/nimblemachines/muforth/tree/master/scripts "scripts") | | |
| [src](/nimblemachines/muforth/tree/master/src "src") | | [src](/nimblemachines/muforth/tree/master/src "src") | | |
| [talks](/nimblemachines/muforth/tree/master/talks "talks") | | [talks](/nimblemachines/muforth/tree/master/talks "talks") | | |
| [.gitattributes](/nimblemachines/muforth/blob/master/.gitattributes ".gitattributes") | | [.gitattributes](/nimblemachines/muforth/blob/master/.gitattributes ".gitattributes") | | |
| [BUILDING](/nimblemachines/muforth/blob/master/BUILDING "BUILDING") | | [BUILDING](/nimblemachines/muforth/blob/master/BUILDING "BUILDING") | | |
| [LICENSE](/nimblemachines/muforth/blob/master/LICENSE "LICENSE") | | [LICENSE](/nimblemachines/muforth/blob/master/LICENSE "LICENSE") | | |
| [README.md](/nimblemachines/muforth/blob/master/README.md "README.md") | | [README.md](/nimblemachines/muforth/blob/master/README.md "README.md") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [License](#)
# What is muforth?
muforth is a small, simple, fast, indirect-threaded code (ITC) Forth intended
for use as a cross-compiler for microcontrollers and other embedded devices.
It is written in C and its core is very portable. Because of its Forth nature,
it is naturally extensible, scriptable, and customizable.
muforth is very well-suited to interactive coding, debugging, and exploration,
and is a great tool for bringing up new hardware.
It has support in varying degrees of completeness for a number of
different architectures and chip families.
* [8051](/nimblemachines/muforth/blob/master/mu/target/8051)
* [ARMv6-m](/nimblemachines/muforth/blob/master/mu/target/ARM/v6-m) (aka Cortex-M0/M0+)
* [ARMv7-m](/nimblemachines/muforth/blob/master/mu/target/ARM/v7-m) (aka Cortex-M3/M4/M7)
* [AVR](/nimblemachines/muforth/blob/master/mu/target/AVR) (Atmel/Microchip)
* [HC08 and HCS08](/nimblemachines/muforth/blob/master/mu/target/S08) (Motorola/Freescale/NXP)
* [MSP430](/nimblemachines/muforth/blob/master/mu/target/MSP430) (TI)
* [PIC18](/nimblemachines/muforth/blob/master/mu/target/PIC18) (Microchip)
* [RISC-V](/nimblemachines/muforth/blob/master/mu/target/RISC-V) (initially, the SiFive FE310 and GigaDevice
GD32VF103)
# Tethered vs self-hosted
Unlike a "self-hosted" Forth, where the target contains the dictionary, the
text interpreter, and all the tools necessary for assembling and compiling
code, muforth supports a *tethered* development model. muforth runs on the
*host* machine, compiling code and data that are later copied to the *target*
machine and executed there.
Because the dictionary and all the compilation tools reside on the *host*,
only the *compiled* code and data reside on the target. This makes it possible
to target *very* small devices that only have a few kilobytes of flash and a
few hundred bytes of RAM. In contrast, a self-hosted Forth often needs 16 KiB
(or more) of flash to be useful, and consumes RAM for the text interpreter and
compiler.
The host machine is also orders of magnitude faster than the target, so doing
the compilation on the host is essentially instantaneous.
# Why yet another Forth?
I initially wrote muforth because I wanted to try out some implementation
ideas. The core language primitives are written in C, but initially muforth
compiled Forth words via a simple native code compiler for the x86. I quickly
realized that simplicity and portability were more important than speed. The
current implementation is a straightforward indirect-threaded Forth - and it
is *quite* fast!
Its implementation is no longer the point. Its sole reason for existing is to
be a cross-compiler for *other* Forths, and their implementations are in no
way tied to muforths. In fact, muforth can be used to compile *any* sort of
code onto the target. I've used it very successfully as a smart assembler for
writing AVR and S08 code.
By keeping it small and simple, it is much more likely to be a useful tool
that people can customize.
Its [BSD licensed](/nimblemachines/muforth/blob/master/LICENSE), so do what you want with it! Id love to hear
about innovative or unusual uses of muforth.
# Starting points
[BUILDING](/nimblemachines/muforth/blob/master/BUILDING) will tell you how to build muforth. Its very simple.
Look in [mu/target/](/nimblemachines/muforth/blob/master/mu/target) to find a target that interests you. There is
generally a `mu/target/<target-name>/build.mu4` that loads the cross-build
environment. Use it as an “index” to find the assembler, disassembler,
meta-compiler, kernel, and other key pieces of code.
# Documentation
Sadly, there isnt a lot of documentation right now. A good place to start is
to read the source.
The code both the C code that implements the Forth virtual machine and the
muforth code that does everything else is carefully and in some cases
extensively (even obsessively!) commented. Right now your best source of
documentation is the code! Luckily for you, there isnt that much of it, so
reading it is actually possible. Thats part of the point of muforth; I want
it to be a [convivial tool](https://www.nimblemachines.com/convivial-tool/).
The heart of the system is the Forth code that muforth reads when it first
starts: [mu/startup.mu4](/nimblemachines/muforth/blob/master/mu/startup.mu4). Youll learn a lot by reading this!
[muforth.dev](https://muforth.dev/) will
eventually host the muforth documentation. At the moment, it is a collection
of [journals, essays, and “getting started” pages](https://muforth.dev/all-pages/).
# News
Follow [@muforth.dev](https://bsky.app/profile/muforth.dev) for updates about
the project and related things (eg, interesting development boards) that I'm
thinking about.
# Talks
In March 2008 I gave a [talk](https://vimeo.com/859408) about bootstrapping,
muforth, and [convivial tools](https://www.nimblemachines.com/convivial-tool/).
Warning: I wave my arms around a lot, and the audio and video quality isnt
that great, but you might find it interesting, or at least amusing.
Its also hard to see my slides. If you want to “follow along”,
[download my slides](https://raw.githubusercontent.com/nimblemachines/muforth/master/talks/2008-mar-30-PNCA),
and use `less` to view them ideally in a text window that is at least 30
lines high like so:
```
less -30 ~/muforth/talks/2008-mar-30-PNCA
```
[![March 2008 talk on Vimeo](https://user-images.githubusercontent.com/3320/214488827-47171f1b-5221-44d0-b9d9-7febcff83628.png)](https://vimeo.com/859408)
# Above all, enjoy!
## About
A simple, indirect-threaded Forth, written in C; for target compiling; runs on Linux, BSD, OSX, and Cygwin
[muforth.dev/](https://muforth.dev/ "https://muforth.dev/")
### Resources
[Readme](#readme-ov-file)
### License
[View license](#License-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/nimblemachines/muforth/activity)
### Stars
[**153**
stars](/nimblemachines/muforth/stargazers)
### Watchers
[**20**
watching](/nimblemachines/muforth/watchers)
### Forks
[**34**
forks](/nimblemachines/muforth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fnimblemachines%2Fmuforth&report=nimblemachines+%28user%29)
## [Releases](/nimblemachines/muforth/releases)
No releases published
## [Packages 0](/users/nimblemachines/packages?repo_name=muforth)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## [Contributors 4](/nimblemachines/muforth/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [Forth
90.9%](/nimblemachines/muforth/search?l=forth)
* [Assembly
3.3%](/nimblemachines/muforth/search?l=assembly)
* [Lua
2.9%](/nimblemachines/muforth/search?l=lua)
* [C
2.1%](/nimblemachines/muforth/search?l=c)
* [Roff
0.3%](/nimblemachines/muforth/search?l=roff)
* [Shell
0.2%](/nimblemachines/muforth/search?l=shell)
* Other
0.3%
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,357 @@
# SmithForth_RISC-V
**Source:** https://github.com/AndreiDuma/SmithForth_RISC-V
GitHub - AndreiDuma/SmithForth\_RISC-V: An accessible Forth written in machine code for the RISC-V architecture.
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FAndreiDuma%2FSmithForth_RISC-V)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FAndreiDuma%2FSmithForth_RISC-V)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=AndreiDuma%2FSmithForth_RISC-V)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[AndreiDuma](/AndreiDuma)
/
**[SmithForth\_RISC-V](/AndreiDuma/SmithForth_RISC-V)**
Public
* [Notifications](/login?return_to=%2FAndreiDuma%2FSmithForth_RISC-V) You must be signed in to change notification settings
* [Fork
2](/login?return_to=%2FAndreiDuma%2FSmithForth_RISC-V)
* [Star
23](/login?return_to=%2FAndreiDuma%2FSmithForth_RISC-V)
An accessible Forth written in machine code for the RISC-V architecture.
### License
[EUPL-1.2 license](/AndreiDuma/SmithForth_RISC-V/blob/main/LICENSE)
[23
stars](/AndreiDuma/SmithForth_RISC-V/stargazers) [2
forks](/AndreiDuma/SmithForth_RISC-V/forks) [Branches](/AndreiDuma/SmithForth_RISC-V/branches) [Tags](/AndreiDuma/SmithForth_RISC-V/tags) [Activity](/AndreiDuma/SmithForth_RISC-V/activity)
[Star](/login?return_to=%2FAndreiDuma%2FSmithForth_RISC-V)
[Notifications](/login?return_to=%2FAndreiDuma%2FSmithForth_RISC-V) You must be signed in to change notification settings
* [Code](/AndreiDuma/SmithForth_RISC-V)
* [Issues
2](/AndreiDuma/SmithForth_RISC-V/issues)
* [Pull requests
0](/AndreiDuma/SmithForth_RISC-V/pulls)
* [Security
0](/AndreiDuma/SmithForth_RISC-V/security)
* [Insights](/AndreiDuma/SmithForth_RISC-V/pulse)
Additional navigation options
* [Code](/AndreiDuma/SmithForth_RISC-V)
* [Issues](/AndreiDuma/SmithForth_RISC-V/issues)
* [Pull requests](/AndreiDuma/SmithForth_RISC-V/pulls)
* [Security](/AndreiDuma/SmithForth_RISC-V/security)
* [Insights](/AndreiDuma/SmithForth_RISC-V/pulse)
# AndreiDuma/SmithForth\_RISC-V
main
[Branches](/AndreiDuma/SmithForth_RISC-V/branches)[Tags](/AndreiDuma/SmithForth_RISC-V/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[4 Commits](/AndreiDuma/SmithForth_RISC-V/commits/main/) 4 Commits | | |
| [.gitignore](/AndreiDuma/SmithForth_RISC-V/blob/main/.gitignore ".gitignore") | | [.gitignore](/AndreiDuma/SmithForth_RISC-V/blob/main/.gitignore ".gitignore") | | |
| [LICENSE](/AndreiDuma/SmithForth_RISC-V/blob/main/LICENSE "LICENSE") | | [LICENSE](/AndreiDuma/SmithForth_RISC-V/blob/main/LICENSE "LICENSE") | | |
| [Makefile](/AndreiDuma/SmithForth_RISC-V/blob/main/Makefile "Makefile") | | [Makefile](/AndreiDuma/SmithForth_RISC-V/blob/main/Makefile "Makefile") | | |
| [README.md](/AndreiDuma/SmithForth_RISC-V/blob/main/README.md "README.md") | | [README.md](/AndreiDuma/SmithForth_RISC-V/blob/main/README.md "README.md") | | |
| [SForth.dmp](/AndreiDuma/SmithForth_RISC-V/blob/main/SForth.dmp "SForth.dmp") | | [SForth.dmp](/AndreiDuma/SmithForth_RISC-V/blob/main/SForth.dmp "SForth.dmp") | | |
| [build.sh](/AndreiDuma/SmithForth_RISC-V/blob/main/build.sh "build.sh") | | [build.sh](/AndreiDuma/SmithForth_RISC-V/blob/main/build.sh "build.sh") | | |
| [input.fs](/AndreiDuma/SmithForth_RISC-V/blob/main/input.fs "input.fs") | | [input.fs](/AndreiDuma/SmithForth_RISC-V/blob/main/input.fs "input.fs") | | |
| [system.fs](/AndreiDuma/SmithForth_RISC-V/blob/main/system.fs "system.fs") | | [system.fs](/AndreiDuma/SmithForth_RISC-V/blob/main/system.fs "system.fs") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [EUPL-1.2 license](#)
This is an accessible Forth implementation written directly in machine
code for the RISC-V architecture. It is an adaptation of David
Smith's excellent x86-64 [SmithForth](https://dacvs.neocities.org/SF/).
Run with `make run`. You will need to run Linux either on RISC-V
hardware or in a QEMU environment.
This project was developed as part of my Master's [thesis](https://github.com/AndreiDuma/SmithForth_RISC-V/releases/download/v1.0/From_x86-64_Forth_to_RISC-V_Andrei_Dorian_Duma_2024.pdf), in
which I thoroughly annotate SmithForth's machine code before porting
it to RISC-V. The abstract of my thesis is given below:
> In this thesis we present the implementation of a usable Forth
> system, built using only RISC-V machine code and the Linux operating
> system as foundations. We begin by justifying the need for
> accessible programming language implementations, discussing
> desirable features in educational compilers. Having selected Forth
> as our language of choice for an educational language
> implementation, we review existing Forth systems and we motivate why
> creating a RISC-V port is a worthwhile task. Next we thoroughly
> examine SmithForth, a high-quality Forth system for the x86-64
> architecture. After understanding its principles, we port it to
> RISC-V, adapting it to our purposes. Finally, we extend this Forth
> system in Forth itself: we write a RISC- V assembler, we provide
> useful arithmetic and logic operators plus conditional and looping
> constructs. We complete our demonstration with a Forth
> implementation of FizzBuzz, showing the usability of the system.
Those interested can [download](https://github.com/AndreiDuma/SmithForth_RISC-V/releases/download/v1.0/From_x86-64_Forth_to_RISC-V_Andrei_Dorian_Duma_2024.pdf) the thesis document in PDF format.
## About
An accessible Forth written in machine code for the RISC-V architecture.
### Topics
[compiler](/topics/compiler "Topic: compiler")
[master-thesis](/topics/master-thesis "Topic: master-thesis")
[forth](/topics/forth "Topic: forth")
[machine-code](/topics/machine-code "Topic: machine-code")
[risc-v](/topics/risc-v "Topic: risc-v")
### Resources
[Readme](#readme-ov-file)
### License
[EUPL-1.2 license](#EUPL-1.2-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/AndreiDuma/SmithForth_RISC-V/activity)
### Stars
[**23**
stars](/AndreiDuma/SmithForth_RISC-V/stargazers)
### Watchers
[**4**
watching](/AndreiDuma/SmithForth_RISC-V/watchers)
### Forks
[**2**
forks](/AndreiDuma/SmithForth_RISC-V/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2FAndreiDuma%2FSmithForth_RISC-V&report=AndreiDuma+%28user%29)
## [Releases 1](/AndreiDuma/SmithForth_RISC-V/releases)
[Thesis v1.0
Latest
Sep 12, 2024](/AndreiDuma/SmithForth_RISC-V/releases/tag/v1.0)
## Languages
* [Forth
95.2%](/AndreiDuma/SmithForth_RISC-V/search?l=forth)
* [Shell
3.3%](/AndreiDuma/SmithForth_RISC-V/search?l=shell)
* [Makefile
1.5%](/AndreiDuma/SmithForth_RISC-V/search?l=makefile)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,878 @@
# StoneKnifeForth
**Source:** https://github.com/kragen/stoneknifeforth
GitHub - kragen/stoneknifeforth: a tiny self-hosted Forth implementation
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fkragen%2Fstoneknifeforth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fkragen%2Fstoneknifeforth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=kragen%2Fstoneknifeforth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[kragen](/kragen)
/
**[stoneknifeforth](/kragen/stoneknifeforth)**
Public
* [Notifications](/login?return_to=%2Fkragen%2Fstoneknifeforth) You must be signed in to change notification settings
* [Fork
24](/login?return_to=%2Fkragen%2Fstoneknifeforth)
* [Star
436](/login?return_to=%2Fkragen%2Fstoneknifeforth)
a tiny self-hosted Forth implementation
### License
[CC0-1.0 license](/kragen/stoneknifeforth/blob/master/LICENSE.md)
[436
stars](/kragen/stoneknifeforth/stargazers) [24
forks](/kragen/stoneknifeforth/forks) [Branches](/kragen/stoneknifeforth/branches) [Tags](/kragen/stoneknifeforth/tags) [Activity](/kragen/stoneknifeforth/activity)
[Star](/login?return_to=%2Fkragen%2Fstoneknifeforth)
[Notifications](/login?return_to=%2Fkragen%2Fstoneknifeforth) You must be signed in to change notification settings
* [Code](/kragen/stoneknifeforth)
* [Issues
2](/kragen/stoneknifeforth/issues)
* [Pull requests
2](/kragen/stoneknifeforth/pulls)
* [Actions](/kragen/stoneknifeforth/actions)
* [Projects
0](/kragen/stoneknifeforth/projects)
* [Wiki](/kragen/stoneknifeforth/wiki)
* [Security
0](/kragen/stoneknifeforth/security)
* [Insights](/kragen/stoneknifeforth/pulse)
Additional navigation options
* [Code](/kragen/stoneknifeforth)
* [Issues](/kragen/stoneknifeforth/issues)
* [Pull requests](/kragen/stoneknifeforth/pulls)
* [Actions](/kragen/stoneknifeforth/actions)
* [Projects](/kragen/stoneknifeforth/projects)
* [Wiki](/kragen/stoneknifeforth/wiki)
* [Security](/kragen/stoneknifeforth/security)
* [Insights](/kragen/stoneknifeforth/pulse)
# kragen/stoneknifeforth
master
[Branches](/kragen/stoneknifeforth/branches)[Tags](/kragen/stoneknifeforth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[113 Commits](/kragen/stoneknifeforth/commits/master/) 113 Commits | | |
| [.gitattributes](/kragen/stoneknifeforth/blob/master/.gitattributes ".gitattributes") | | [.gitattributes](/kragen/stoneknifeforth/blob/master/.gitattributes ".gitattributes") | | |
| [.gitignore](/kragen/stoneknifeforth/blob/master/.gitignore ".gitignore") | | [.gitignore](/kragen/stoneknifeforth/blob/master/.gitignore ".gitignore") | | |
| [386.c](/kragen/stoneknifeforth/blob/master/386.c "386.c") | | [386.c](/kragen/stoneknifeforth/blob/master/386.c "386.c") | | |
| [LICENSE.md](/kragen/stoneknifeforth/blob/master/LICENSE.md "LICENSE.md") | | [LICENSE.md](/kragen/stoneknifeforth/blob/master/LICENSE.md "LICENSE.md") | | |
| [Makefile](/kragen/stoneknifeforth/blob/master/Makefile "Makefile") | | [Makefile](/kragen/stoneknifeforth/blob/master/Makefile "Makefile") | | |
| [Q.tbf1](/kragen/stoneknifeforth/blob/master/Q.tbf1 "Q.tbf1") | | [Q.tbf1](/kragen/stoneknifeforth/blob/master/Q.tbf1 "Q.tbf1") | | |
| [README.md](/kragen/stoneknifeforth/blob/master/README.md "README.md") | | [README.md](/kragen/stoneknifeforth/blob/master/README.md "README.md") | | |
| [TODO](/kragen/stoneknifeforth/blob/master/TODO "TODO") | | [TODO](/kragen/stoneknifeforth/blob/master/TODO "TODO") | | |
| [build](/kragen/stoneknifeforth/blob/master/build "build") | | [build](/kragen/stoneknifeforth/blob/master/build "build") | | |
| [cat.tbf1](/kragen/stoneknifeforth/blob/master/cat.tbf1 "cat.tbf1") | | [cat.tbf1](/kragen/stoneknifeforth/blob/master/cat.tbf1 "cat.tbf1") | | |
| [cat1.tbf1](/kragen/stoneknifeforth/blob/master/cat1.tbf1 "cat1.tbf1") | | [cat1.tbf1](/kragen/stoneknifeforth/blob/master/cat1.tbf1 "cat1.tbf1") | | |
| [disassemble](/kragen/stoneknifeforth/blob/master/disassemble "disassemble") | | [disassemble](/kragen/stoneknifeforth/blob/master/disassemble "disassemble") | | |
| [hello42.tbf1](/kragen/stoneknifeforth/blob/master/hello42.tbf1 "hello42.tbf1") | | [hello42.tbf1](/kragen/stoneknifeforth/blob/master/hello42.tbf1 "hello42.tbf1") | | |
| [hi.tbf1](/kragen/stoneknifeforth/blob/master/hi.tbf1 "hi.tbf1") | | [hi.tbf1](/kragen/stoneknifeforth/blob/master/hi.tbf1 "hi.tbf1") | | |
| [onescreen.tbf1](/kragen/stoneknifeforth/blob/master/onescreen.tbf1 "onescreen.tbf1") | | [onescreen.tbf1](/kragen/stoneknifeforth/blob/master/onescreen.tbf1 "onescreen.tbf1") | | |
| [star.tbf1](/kragen/stoneknifeforth/blob/master/star.tbf1 "star.tbf1") | | [star.tbf1](/kragen/stoneknifeforth/blob/master/star.tbf1 "star.tbf1") | | |
| [tiny.asm](/kragen/stoneknifeforth/blob/master/tiny.asm "tiny.asm") | | [tiny.asm](/kragen/stoneknifeforth/blob/master/tiny.asm "tiny.asm") | | |
| [tinyboot.py](/kragen/stoneknifeforth/blob/master/tinyboot.py "tinyboot.py") | | [tinyboot.py](/kragen/stoneknifeforth/blob/master/tinyboot.py "tinyboot.py") | | |
| [tinyboot.s](/kragen/stoneknifeforth/blob/master/tinyboot.s "tinyboot.s") | | [tinyboot.s](/kragen/stoneknifeforth/blob/master/tinyboot.s "tinyboot.s") | | |
| [tinyboot1.tbf1](/kragen/stoneknifeforth/blob/master/tinyboot1.tbf1 "tinyboot1.tbf1") | | [tinyboot1.tbf1](/kragen/stoneknifeforth/blob/master/tinyboot1.tbf1 "tinyboot1.tbf1") | | |
| [trace.py](/kragen/stoneknifeforth/blob/master/trace.py "trace.py") | | [trace.py](/kragen/stoneknifeforth/blob/master/trace.py "trace.py") | | |
| [trim.py](/kragen/stoneknifeforth/blob/master/trim.py "trim.py") | | [trim.py](/kragen/stoneknifeforth/blob/master/trim.py "trim.py") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [CC0-1.0 license](#)
# StoneKnifeForth
This is StoneKnifeForth, a very simple language inspired by Forth. It
is not expected to be useful; instead, its purpose is to show how
simple a compiler can be. The compiler is a bit under two pages of
code when the comments are removed.
This package includes a “metacircular compiler” which is written in
StoneKnifeForth and compiles StoneKnifeForth to an x86 Linux ELF
executable.
There is also a StoneKnifeForth interpreter written in Python (tested
with Python 2.4). It seems to be about 100× slower than code emitted
by the compiler.
(All of the measurements below may be a bit out of date.)
On my 700MHz laptop, measuring wall-clock time:
* compiling the compiler, using the compiler running in the interpreter,
takes about 10 seconds;
* compiling the compiler, using the compiler compiled with the compiler,
takes about 0.1 seconds;
* compiling a version of the compiler from which comments and extra
whitespace have been “trimmed”, using the compiler compiled with the
compiler, takes about 0.02 seconds.
So this is a programming language implementation that can recompile
itself from source twice per 24fps movie frame. The entire “trimmed”
source code is 1902 bytes, which is less than half the size of the
nearest comparable project that Im aware of, `otccelf`, which is 4748
bytes.
As demonstrated by the interpreter written in Python, the programming
language itself is essentially machine-independent, with very few
x86 quirks:
* items on the stack are 32 bits in size;
* arithmetic is 32-bit;
* stack items stored in memory not only take up 4 bytes, but they are
little-endian.
(It would be fairly easy to make a tiny “compiler” if the source
language were, say, x86 machine code.)
The output executable is 4063 bytes, containing about 1400
instructions. `valgrind` reports that it takes 1,813,395 instructions
to compile itself. (So you would think that it could compile itself
in 2.6 ms. The long runtimes are a result of reading its input one
byte at at time.)
## Why? To Know What Im Doing
A year and a half ago, I wrote a [metacircular Bicicleta-language
interpreter](http://lists.canonical.org/pipermail/kragen-hacks/2007-February/000450.html), and I said:
> Alan Kay frequently expresses enthusiasm over the metacircular Lisp
> interpreter in the Lisp 1.5 Programmers Manual. For example, in
> <http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=273&page=4>
> he writes:
>
> > ```
> > Yes, that was the big revelation to me when I was in graduate
> > school — when I finally understood that the half page of code on
> > the bottom of page 13 of the Lisp 1.5 manual was Lisp in
> > itself. These were “Maxwells Equations of Software!” This is the
> > whole world of programming in a few lines that I can put my hand
> > over.
> >
> > I realized that anytime I want to know what Im doing, I can just
> > write down the kernel of this thing in a half page and its not
> > going to lose any power. In fact, its going to gain power by
> > being able to reenter itself much more readily than most systems
> > done the other way can possibly do.
> > ```
But if you try to implement a Lisp interpreter in a low-level language
by translating that metacircular interpreter into it (as [I did later
that year](http://lists.canonical.org/pipermail/kragen-hacks/2007-September/000464.html)) you run into a problem. The metacircular interpreter
glosses over a large number of things that turn out to be nontrivial
to implement — indeed, about half of the code is devoted to things
outside of the scope of the metacircular interpreter. Heres a list
of issues that the Lisp 1.5 metacircular interpreter neglects, some
semantic and some merely implementational:
* memory management
* argument evaluation order
* laziness vs. strictness
* other aspects of control flow
* representation and comparison of atoms
* representation of pairs
* parsing
* type checking and type testing (atom)
* recursive function call and return
* tail-calls
* lexical vs. dynamic scoping
In John C. Reynoldss paper, “[Definitional Interpreters
Revisited](http://www.brics.dk/~hosc/local/HOSC-11-4-pp355-361.pdf)”, Higher-Order and Symbolic Computation, 11, 355361
(1998), he says:
> In the fourth and third paragraphs before the end of Section 5, I
> should have emphasized the fact that a metacircular interpreter is
> not really a definition, since it is trivial when the defining
> language is understood, and otherwise it is ambiguous. In
> particular, Interpreters I and II say nothing about order of
> application, while Interpreters I and III say little about
> higher-order functions. Jim Morris put the matter more strongly:
>
> > The activity of defining features in terms of themselves is highly
> > suspect, especially when they are as subtle as functional
> > objects. It is a fad that should be debunked, in my opinion. A
> > real significance of [a self-defined] interpreter . . . is that it
> > displays a simple universal function for the language in
> > question.
>
> On the other hand, I clearly remember that John McCarthys
> definition of LISP [1DI], which is a definitional interpreter in the
> style of II, was a great help when I first learned that language. But
> it was not the sole support of my understanding.
(For what its worth, it may not even the case that self-defined
interpreters are necessarily Turing-complete; it might be possible to
write a non-Turing-complete metacircular interpreter for a
non-Turing-complete language, such as David Turners Total Functional
Programming systems.)
A metacircular compiler forces you to confront this extra complexity.
Moreover, metacircular compilers are self-sustaining in a way that
interpreters arent; once you have the compiler running, you are free
to add features to the language it supports, then take advantage of
those features in the compiler.
So this is a “stone knife” programming tool: bootstrapped out of
almost nothing as quickly as possible.
## Why? To Develop a Compiler Incrementally
When I wrote Ur-Scheme, my thought was to see if I could figure out
how to develop a compiler incrementally, starting by building a small
working metacircular compiler in less than a day, and adding features
from there. I pretty much failed; it took me two and a half weeks to
get it to compile itself successfully.
Part of the problem is that a minimal subset of R5RS Scheme powerful
enough to write a compiler in — without making the compiler even
larger due to writing it in a low-level language — is still a
relatively large language. Ur-Scheme doesnt have much arithmetic,
but it does have integers, dynamic typing, closures, characters,
strings, lists, recursion, booleans, variadic functions, `let` to
introduce local variables, character and string literals, a sort of
crude macro system, five different conditional forms (if, cond, case,
and, or), quotation, tail-call optimization, function argument count
verification, bounds checking, symbols, buffered input to keep it from
taking multiple seconds to compile itself, and a library of functions
for processing lists, strings, and characters. And each of those
things was added because it was necessary to get the compiler to be
able to compile itself. The end result was that the compiler is 90
kilobytes of source code, about 1600 lines if you leave out the
comments.
Now, maybe you can write 1600 lines of working Scheme in a day, but I
sure as hell cant. Its still not a very large compiler, as
compilers go, but its a lot bigger than `otccelf`. So I hypothesized
that maybe a simpler language, without a requirement for compatibility
with something else, would enable me to get a compiler bootstrapped
more easily.
So StoneKnifeForth was born. Its inspired by Forth, so it inherits
most of Forths traditional simplifications:
* no expressions;
* no statements;
* no types, dynamic or static;
* no floating-point (although Ur-Scheme doesnt have floating-point either);
* no scoping, lexical or dynamic;
* no dynamic memory allocation;
And it added a few of its own:
* no names of more than one byte;
* no user-defined IMMEDIATE words (the Forth equivalent of Lisp macros);
* no interpretation state, so no compile-time evaluation at all;
* no interactive REPL;
* no `do` loops;
* no `else` on `if` statements;
* no recursion;
* no access to the return stack;
* no access to the filesystem, just stdin and stdout;
* no multithreading.
Surprisingly, the language that results is still almost bearable to
write a compiler in, although it definitely has the flavor of an
assembler.
Unfortunately, I still totally failed to get it done in a day. It was
15 days from when I first started scribbling about it in my notebook
until it was able to compile itself successfully, although `git` only
shows active development happening on six of those days (including
some help from my friend Aristotle). So thats an improvement, but
not as much of an improvement as I would like. At that point, it was
13k of source, 114 non-comment lines of code, which is definitely a
lot smaller than Ur-Schemes 90k and 1600 lines. (Although there are
another 181 lines of Python for the bootstrap interpreter.)
Its possible to imagine writing and debugging 114 lines of code in a
day, or even 300 lines. Its still maybe a bit optimistic to think I could
do that in a day, so maybe I need to find a way to increase
incrementality further.
My theory was that once I had a working compiler, I could add features
to the language incrementally and test them as I went. So far I
havent gotten to that part.
## Why? Wirth envy
[Michael Franz writes](http://www.ics.uci.edu/~franz/Site/pubs-pdf/BC03.pdf "Oberon — the overlooked jewel"):
> In order to find the optimal cost/benefit ratio, Wirth used a highly
> intuitive metric, the origin of which is unknown to me but that may
> very well be Wirths own invention. He used the compilers
> self-compilation speed as a measure of the compilers
> quality. Considering that Wirths compilers were written in the
> languages they compiled, and that compilers are substantial and
> non-trivial pieces of software in their own right, this introduced a
> highly practical benchmark that directly contested a compilers
> complexity against its performance. Under the self-compilation speed
> benchmark, only those optimizations were allowed to be incorporated
> into a compiler that accelerated it by so much that the intrinsic
> cost of the new code addition was fully compensated.
Wirth is clearly one of the great apostles of simplicity in
programming, together with with Edsger Dijkstra and Chuck Moore. But
I doubt very much that the Oberon compiler could ever compile itself
in 2 million instructions, given the complexity of the Oberon
language.
R. Kent Dybvig used the same criterion; speaking of the 19851987
development of Chez Scheme, [he writes](http://www.cs.indiana.edu/~dyb/pubs/hocs.pdf "The Development of Chez Scheme"):
> At some point we actually instituted the following rule to keep a
> lid on compilation overhead: if an optimization doesnt make the
> compiler itself enough faster to make up for the cost of doing the
> optimization, the optimization is discarded. This ruled out several
> optimizations we tried, including an early attempt at a source
> optimizer.
## Far-Fetched Ways This Code Could Actually be Useful
The obvious way that it could be useful is that you could read it and
learn things from it, then put them to use in actually useful
software. This section is about the far-fetched ways instead.
If you want to counter Ken Thompsons “Trusting Trust” attack, you
would want to start with a minimal compiler on a minimal chip;
StoneKnifeForth might be a good approach.
## Blind Alleys
Here are some things I thought about but didnt do.
### Making More Things Into Primitives
There are straightforward changes to reduce the executable size
further, but they would make the compiler more complicated, not
simpler. Some of the most-referenced routines should be open-coded,
which should also speed it up, as well as making them available to
other programs compiled with the same compiler. Here are the routines
that were called in more than 10 places some time ago:
```
11 0x169 xchg
13 0xc20 Lit
22 0x190 - (now replaced by +, which is only used in 25 places)
25 0x15b pop
26 0x1bc =
35 0x13d dup
60 0x286 .
```
Of these, `xchg`, `pop`, `-`, `=`, and `dup` could all be open-coded
at zero or negative cost at the call sites, and then their definitions
and temporary variables could be removed.
I tried out open-coding `xchg`, `pop`, `dup`, and `+`. The executable
shrank by 346 bytes (from 4223 bytes to 3877 bytes, an 18% reduction;
it also executed 42% fewer instructions to compile itself, from
1,492,993 down to 870,863 on the “trimmed” version of itself), and the
source code stayed almost exactly the same size, at 119 non-comment
lines; the machine-code definitions were one line each. They look
like this:
```
dup 'd = [ pop 80 . ; ] ( dup is `push %eax` )
dup 'p = [ pop 88 . ; ] ( pop is `pop %eax` )
dup 'x = [ pop 135 . 4 . 36 . ; ] ( xchg is xchg %eax, (%esp)
dup '+ = [ pop 3 . 4 . 36 . 89 . ; ] ( `add [%esp], %eax; pop %ecx` )
```
However, I decided not to do this. The current compiler already
contains 58 bytes of machine code, and this would add another 9 bytes
to that. The high-level Forth definitions (`: dup X ! ;` and the
like) are, I think, easier to understand and verify the correctness
of; and they dont depend on lower-level details like what
architecture were compiling for, or how we represent the stacks.
Additionally, it adds another step to the bootstrap process.
### Putting the Operand Stack on `%edi`
Forth uses two stacks: one for procedure nesting (the “return stack”)
and one for parameter passing (the “data stack” or “operand stack”).
This arrangement is shared by other Forth-like languages such as
PostScript and HP calculator programs. Normally, in Forth, unlike in
these other languages, the “return stack” is directly accessible to
the user.
Right now, StoneKnifeForth stores these two stacks mostly in memory,
although it keeps the top item of the operand stack in `%eax`. The
registers `%esp` and `%ebp` point to the locations of the stacks in
memory; the one thats currently being used is in `%esp`, and the
other one is in `%ebp`. So the compiler has to emit an `xchg %esp, %ebp` instruction whenever it switches between the two stacks. As a
result, when compiling itself, something like 30% of the instructions
it emits are `xchg %esp, %ebp`.
Inspired, I think, by colorForth, I considered just keeping the
operand stack pointer in `%edi` and using it directly from there,
rather than swapping it into `%esp`. The x86 has a `stosd`
instruction (GCC calls it `stosl`) which will write a 32-bit value in
`%eax` into memory at `%edi` and increment (or decrement) `%edi` by 4,
which is ideal for pushing values from `%eax` (as in `Lit`, to make
room for the new value). Popping values off the stack, though,
becomes somewhat hairier. The `lodsd` or `lodsl` instruction that
corresponds to `stosl` uses `%esi` instead of `%edi`, you have to set
“DF”, the direction flag, to get it to decrement instead of
incrementing, and like `stosl`, it accesses memory *before* updating
the index register, not after.
So, although we would eliminate a lot of redundant and ugly `xchg`
instructions in the output, as well as the `Restack`, `u`, `U`, and
`%flush` functions, a bunch of the relatively simple instruction
sequences currently emitted by the compiler would become hairier.
I think the changes are more or less as follows:
* `!` is currently `pop (%eax); pop %eax`, which is three bytes; this
occurs 17 times in the output. The new code would be:
sub $8, %edi
mov 4(%edi), %ecx
mov %ecx, (%eax)
mov (%edi), %eax
This is ten bytes. `store`, the byte version of `!`, is similar.
* `-` is currently `sub %eax, (%esp); pop %eax`, which is four bytes;
this occurs 23 times in the output. The new code would be seven
bytes:
sub $4, %edi
sub %eax, (%edi)
mov (%edi), %eax
There's something analogous in `<`, although it only occurs three
times.
* in `JZ`, `jnz`, and `Getchar`, there are occurrences of `pop %eax`,
which is one byte (88). The new code would be five bytes:
sub $4, %edi
mov (%edi), %eax
`JZ` occurs 38 times in the output, `jnz` occurs 5 times, and
Getchar occurs once.
* `Msyscall` would change a bit.
There are 193 occurrences of `push %eax` in the output code at the
moment, each of which is followed by a move-immediate into %eax.
These would just change to `stosd`, which is also one byte.
So this change would increase the amount of machine code in the
compiler source by 10 - 3 + 7 - 4 + 5 - 1 + 5 - 1 + 5 - 1 = 22 bytes,
which is a lot given that theres only 58 bytes there now; I think
that would make the compiler harder to follow, although `Restack` does
too. It would also increase the size of the compiler output by (10 -
3) \* 17 + (7 - 4) \* 23 + (5 - 1) \* (38 + 5 + 1) = 364 bytes, although
it would eliminate 430 `xchg %esp, %ebp` instructions, two bytes each,
for a total of 2 \* 430 - 364 = 496 bytes less; and the resulting
program would gain (4 - 2) \* 17 + (3 - 2) \* 23 + (2 - 1) \* (38 + 5 +
1. = 101 instructions, then lose the 430 `xchg` instructions.
My initial thought was that it would be silly to space-optimize
popping at the expense of pushing; although they happen the same
number of times during the execution of the program, generally more
data is passed to callees than is returned to callers, so the number
of push sites is greater than the number of pop sites. (In this
program, its about a factor of 2, according to the above numbers.)
Also, consumers of values from the stack often want to do something
interesting with the top two values on the stack, not just discard the
top-of-stack: `-` subtracts, `<` compares, `!` and `store` send it to
memory. Only `JZ` and `jnz` (and `pop`) just want to discard
top-of-stack — but to my surprise, they make up half of the pops.
However, I wasnt thinking about the number of places in the compiler
where machine code would be added. What if I used `%esi` instead of
`%edi`, to get a single-byte single-instruction pop (in the form of
`lodsl`) instead of a single-byte push? This would make `Lit` (the
only thing that increases the depth of the operand stack) uglier, and
each of the 193 occurrencies of `push %eax` that result from the 193
calls to `Lit` in the compilation process would get four bytes bigger
(totaling 772 extra bytes) but the seven or so primitives that
*decrease* the depth of the operand stack would gain less extra
complexity. And wed still lose the `xchg %esp, %ebp` crap, including
the code to avoid emitting them.
## Whats Next
Maybe putting the operand stack on `%esi`.
Maybe factor some commonality out of the implementation of `-` and
`<`.
If we move the creation of the ELF header and `Msyscall` and `/buf` to
run-time instead of compile-time, we could eliminate the `#` and
`byte` compile-time directives, both from the compiler and the
interpreter; the output would be simpler; `Msyscall` and `/buf`
wouldn't need two separate names and tricky code to poke them into the
output; the tricky code wouldnt need a nine-line comment explaining
it; the characters E, L, and F wouldnt need to be magic
numbers.
Maybe factor out "0 1 -"!
Maybe pull the interpreter and compiler code into a literate document
that explains them.
Maybe building a compiler for a slightly bigger and better language on
top of this one. Maybe something like Lua, Scheme, or Smalltalk. A
first step toward that would be something that makes parsing a little
more convenient. Another step might be to establish some kind of
intermediate representation in the compiler, and perhaps some kind of
pattern-matching facility to make it easier to specify rewrites on the
intermediate representation (either for optimizations or for code
generation).
Certainly the system as it exists is not that convenient to program
in, the code is pretty hard to read, and when it fails, it is hard to
debug — especially in the compiler, which doesnt have any way to emit
error messages. Garbage collection, arrays with bounds-checking,
finite maps (associative arrays), strong typing (any typing, really),
dynamic dispatch, some thing that saves you from incorrect stack
effects, metaprogramming, and so on, these would all help; an
interactive REPL would be a useful non-linguistic feature.
## Copyright status
I (Kragen Javier Sitaker) wrote StoneKnifeForth in 2008 and published
it immediately in Argentina. I didn't add an explicit copyright
license at the time, but here is one now:
> [To the extent possible under law, Kragen Javier Sitaker has waived
> all copyright and related or neighboring rights to
> StoneKnifeForth](https://creativecommons.org/publicdomain/zero/1.0/). This
> work is published from: Argentina.
For more details, I've included the CC0 "legal code" in
[LICENSE.md](/kragen/stoneknifeforth/blob/master/LICENSE.md).
## Related work
Andre Adrians 2008 BASICO: <http://www.andreadrian.de/tbng/>
> * is a small imperative programming language that is just powerful
> enough to compile itself (compiler bootstrapping).
> * has no GOTO, but has while-break-wend and multiple return
> * has C-like string handling.
> * is implemented in less then 1000 source code lines for the compiler.
> * produces real binary programs for x86 processors, not P-code or
> Byte-Code.
> * uses the C compiler toolchain (assembler, linker)
> * uses C library functions like printf(), getchar(), strcpy(),
> isdigit(), rand() for run-time support.
Actually it produces assembly, not executables.
Version 0.9 was released 15 Jul 2006. The 1000 source lines include a
recursive-descent parser and a hand-coded lexer.
Sample code:
```
// return 1 if ch is in s, 0 else
func in(ch: char, s: array char): int
var i: int
begin
i = 0
while s[i] # 0 do
if ch = s[i] then
return 1
endif
i = i + 1
wend
return 0
end
```
FIRST and THIRD, from [the IOCCC entry](http://www.ioccc.org/1992/buzzard.2.design).
[Ian Piumartas COLA](http://piumarta.com/software/cola/) system.
Oberon.
Fabrice Bellards [OTCC](https://bellard.org/otcc/).
[F-83](https://github.com/ForthHub/F83).
eForth, especially the ITC [eForth](http://www.exemark.com/FORTH/eForthOverviewv5.pdf).
Jack Crenshaws [Lets Build a Compiler](http://compilers.iecc.com/crenshaw/). This is a how-to book
that walks you through an incrementally-constructed compiler for a toy
language, written in Pascal, in about 340 pages of text. The text is
really easy to read, but it will still take at least three to ten
hours to read. It uses recursive-descent parsing, no intermediate
representation, and it emits 68000 assembly code.
Ikarus.
[Ur-Scheme](http://canonical.org/~kragen/sw/urscheme/).
PyPy.
Bootstrapping a simple compiler from nothing:
Edmund GRIMLEY EVANS
2001
<http://web.archive.org/web/20061108010907/http://www.rano.org/bcompiler.html>
## About
a tiny self-hosted Forth implementation
### Resources
[Readme](#readme-ov-file)
### License
[CC0-1.0 license](#CC0-1.0-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/kragen/stoneknifeforth/activity)
### Stars
[**436**
stars](/kragen/stoneknifeforth/stargazers)
### Watchers
[**21**
watching](/kragen/stoneknifeforth/watchers)
### Forks
[**24**
forks](/kragen/stoneknifeforth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fkragen%2Fstoneknifeforth&report=kragen+%28user%29)
## [Releases](/kragen/stoneknifeforth/releases)
No releases published
## [Packages 0](/users/kragen/packages?repo_name=stoneknifeforth)
No packages published
## [Contributors 4](/kragen/stoneknifeforth/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [Forth
50.1%](/kragen/stoneknifeforth/search?l=forth)
* [C
23.4%](/kragen/stoneknifeforth/search?l=c)
* [Python
16.6%](/kragen/stoneknifeforth/search?l=python)
* [Assembly
7.6%](/kragen/stoneknifeforth/search?l=assembly)
* [Shell
2.3%](/kragen/stoneknifeforth/search?l=shell)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,316 @@
# Substack Article
**Source:** https://edsabode.substack.com/p/onats-kyra-compiled-forths-a-new
Onat's KYRA, Compiled FORTHs, a new rabbit hole..
[![Eds Abode](https://substackcdn.com/image/fetch/$s_!CWqS!,w_40,h_40,c_fill,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F269dc3fe-008b-4f8a-bc69-13c53c840346_376x378.png)](/)
# [Eds Abode](/)
SubscribeSign in
# Onat's KYRA, Compiled FORTHs, a new rabbit hole..
[![Ed's avatar](https://substackcdn.com/image/fetch/$s_!_PzK!,w_36,h_36,c_fill,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fed2663-82a9-4c29-9a20-fab2605e47f3_376x378.png)](https://substack.com/@edsabode)
[Ed](https://substack.com/@edsabode)
May 30, 2025
2
Share
While on twitter doing the usual engagements, someone linked me a vod of a non-text based editor done entirely in a custom toolchain:
I cant write yet on everything thats going on in this talk. But what I do know is that I will be making time to learn. Below will be notes that Ive accumulated so far in this pursuit.
Onat has a website an [article](https://onatto.github.io/lang.html) on KYRA. We immediately learn that its a “concatenative language” derived from offshoots of FORTH. Particularly Moores own [colorFORTH](https://colorforth.github.io/cf.htm) along with taking heavy inspiration from Timothy Lottess custom compiled Forth-like he worked on throughout the late 2000s up to 2016 at least (his blog is dead and the only archive of it is a github [repo](https://github.com/gomson/TimothyLottes.github.io)).
[![](https://substackcdn.com/image/fetch/$s_!Dx2Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1cb08da-0b75-4db5-b33a-0040de289d41_1920x1080.png)](https://substackcdn.com/image/fetch/$s_!Dx2Y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1cb08da-0b75-4db5-b33a-0040de289d41_1920x1080.png)
[![](https://substackcdn.com/image/fetch/$s_!7nj0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e2a374d-a99f-4a64-bd07-b36ef76e625d_1920x1080.png)](https://substackcdn.com/image/fetch/$s_!7nj0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e2a374d-a99f-4a64-bd07-b36ef76e625d_1920x1080.png)
Edit - Older Vod from 2020:
---
## TimothyLottes.github.io
I will catalogue below all the relevant pages from Timothy Lottess archived blog. They can previewed without download a zip archive with the preview button on the top right-corner of githubs text viewer:
[![](https://substackcdn.com/image/fetch/$s_!sFJ6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c5bb33e-94db-4eeb-a5d2-b6a3e99519b1_1258x269.png)](https://substackcdn.com/image/fetch/$s_!sFJ6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c5bb33e-94db-4eeb-a5d2-b6a3e99519b1_1258x269.png)
* [20070910 - 2 4th | !2 4th](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20070910.html)
* [20070912 - The Making of a Font](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20070912.html)
* [20070915 - Building the Chicken Without an Egg](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20070915.html)
* [20070919 - Editor Working](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20070919.html)
* [20070921 - Assembler in Atom4th](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20070921.html)
[![](https://substackcdn.com/image/fetch/$s_!APbi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81401d69-cd06-4ec5-ad3c-c1357ff9577e_640x480.jpeg)](https://substackcdn.com/image/fetch/$s_!APbi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81401d69-cd06-4ec5-ad3c-c1357ff9577e_640x480.jpeg)
* [20140816 - Vintage Programming](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20140816.html)
[![](https://substackcdn.com/image/fetch/$s_!_ApA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde18f837-12fd-4edc-b265-7ecd2371bb8a_640x640.png)](https://substackcdn.com/image/fetch/$s_!_ApA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde18f837-12fd-4edc-b265-7ecd2371bb8a_640x640.png)
* [20141231 - Continued Notes on Custom Language](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20141231.html)
* [20150414 - From Scratch Bug](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150414.html)
* [20150420 - From Scratch Bug 2 : Source-Less Programming](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150420.html)
+ [20150422 - Source-Less Programming : 2](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150422.html)
+ [20150423 - Source-Less Programming : 3](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150423.html)
+ [20150424 - Source-Less Programming : 4](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150424.html)
+ [20150426 - Source-Less Programming : 5](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150426.html)
* [20150710 - Inspiration Reboot](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150710.html)
* [20150714 - 1536-1 : The Programmer Addiction = Feedback](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150714.html)
+ [20150715 - 1536-2 : Assembling From the Nothing](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150715.html)
+ [20150722 - 1536-3 : Simplify, Repeat](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150722.html)
+ [20150809 - 1536-4 : Coloring](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150809.html)
[![](https://substackcdn.com/image/fetch/$s_!Sc2T!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0799032f-f2d8-43ec-a7ee-bf3b8fcdc16f_640x400.png)](https://substackcdn.com/image/fetch/$s_!Sc2T!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0799032f-f2d8-43ec-a7ee-bf3b8fcdc16f_640x400.png)
+ [20150810 - 1536-5 : Keys](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20150810.html)
[![](https://substackcdn.com/image/fetch/$s_!wv3-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faff0bdf1-272a-4d85-929e-3a9d7917c628_640x400.png)](https://substackcdn.com/image/fetch/$s_!wv3-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faff0bdf1-272a-4d85-929e-3a9d7917c628_640x400.png)
* [20151113 - Rethinking the Symbolic Dictionary](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20151113.html)
* [20151222 - Random Holiday 2015](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20151222.html)
* [20161113 - Vintage Programming 2](https://refined-github-html-preview.kidonng.workers.dev/gomson/TimothyLottes.github.io/raw/refs/heads/master/20161113.html)
* github.com/TimothyLottes/A (DEAD)
---
The above is great and all, but very difficult to enter the world of if you dont have any assembly background. In my case; Ive only recently began to focus on curating my C, C++ and more recently: Odin code more closely; as of being introduced to the “Handmade” communities around 2019. With the furthest Ive gone being reducing runtime symbol pollution, making sure my code paths and data structures are simple and sane. I can read disassembly to a useful extent… So whats the best place to start?
As with most things I find its easiest to learn something by constructive a narrative to world build off of. So gaining a historical perspective of FORTHs development and attempting to chain that in with some “Trial By Fire” guide to forth and a “compiled” FORTH. Most forths have this interpreter layer and operation with how they behave that seems to act as a mock repl or editor. From what I can tell Onats and Lottess goals are something else, where the editor provided that mechanism not the “language” processing layer.
* The classic *start* page for FORTH: [Forth Language](https://wiki.c2.com/?ForthLanguage)
+ History and more laid out there
+ *StartingForth* book..
* [jonesforth.S](https://github.com/nornagon/jonesforth/blob/master/jonesforth.S) seems to be the best introduction to the original language.
After I finish my initial knowledge base curation I think Ill start with getting jonesforth ported to a windows x64 process sandbox. Ill need to learn dealing with assembly directly. Ill probably will go with GAS, FASM, or MASM, whichever provides an easier debugging experience. The original source is targeting x86-32 linux. I could try to get that ported to work on a steam deck instead after as well… Much to digest.
2
Share
#### Discussion about this post
CommentsRestacks
![User's avatar](https://substackcdn.com/image/fetch/$s_!TnFC!,w_32,h_32,c_fill,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack.com%2Fimg%2Favatars%2Fdefault-light.png)
TopLatest
No posts
### Ready for more?
Subscribe
© 2026 Ed · [Privacy](https://substack.com/privacy) ∙ [Terms](https://substack.com/tos) ∙ [Collection notice](https://substack.com/ccpa#personal-data-collected)
[Start your Substack](https://substack.com/signup?utm_source=substack&utm_medium=web&utm_content=footer)[Get the app](https://substack.com/app/app-store-redirect?utm_campaign=app-marketing&utm_content=web-footer-button)
[Substack](https://substack.com) is the home for great culture
This site requires JavaScript to run correctly. Please [turn on JavaScript](https://enable-javascript.com/) or unblock scripts

View File

@@ -0,0 +1,315 @@
# Threaded code
**Source:** https://muforth.dev/threaded-code/
Threaded code muforth
# Threaded code
---
My aim here is to tackle threaded code: What it is, why it is, how it works, and why its great (and not so great).
Rather than starting with a definition and then attempting an explanation of the definition, I want to start with a thought experiment.
Take a program. Then refactor it in such a way that it consists entirely of only two kinds of routines:
* leaf routines, which compute and do I/O, but which make no calls to other code
* twig routines, which do *no* computation or I/O; instead, they *only* call other code (which can be twig or leaf routines)
(I was tempted to use the usual tree-structure names of “leaf” and “branch”, but branch is overloaded with the idea of a jump, which might be confusing in this context. So: twig.)
The performance-minded among you are now aghast. “What? No open-coded arithmetic? No inlining of functions?”
Yes, its true. Our restructuring has a performance cost, but it has advantages too. Well get to both.
Since our twig routines now consist entirely of calls (except for the last instruction, a “return”) we can remove the call opcodes. We end up with a list of addresses. The return instruction that ended our original routine is replaced by the address of a special “exit” routine.
The tail-recursively-minded among you will have already objected “But that last call and return can be replaced by a jump!” Not so with threaded code. There is no way to say we want to “jump” to an address rather than “call” it, so we lose the ability to convert tail calls to jumps. Twig routines always end with the address of the “exit” routine. Another disadvantage to threading. However, we soldier on.
With the opcodes removed, our twig routines are no longer code. We cant “call” one and expect anything good to happen. The CPU will happily start interpreting the list of addresses as instructions and head off into the weeds.
We need a *header* of some kind that tells the CPU that this is not a leaf routine (which we havent changed leaf routines are still machine code) but a twig routine. The header is generally a call to *another* special “runtime” routine. What should this routine do? Because we have been *called*, we must have been called by another twig routine. Just as with machine code that calls other machine code, we need to push a call stack of some kind. But what do we push onto the stack?
Lets back up. We havent talked about *how we are interpreting the list of addresses* that make up the body of a twig routine.
We need a tiny piece of code somewhere that fetches the next address and “executes” the routine that it points to. (I am being purposely vague here.) We are fetching and executing “instructions”, which means we need our own “program counter” or “address pointer” or whatever you want to call it, which will always point to the next “instruction” (really an address) to execute. In the Forth world this pointer is usually called **IP** the “instruction” (or perhaps “interpretation”) pointer. Our tiny piece of code will fetch the “instruction” (address) that IP points to, increment IP by the size (in bytes) of an address, and then somehow “execute” the code at that address.
Im not sure about other language communities, but in the Forth community this tiny piece of code is called **NEXT**. Its only job: to execute the next address in the list.
Now that we have an idea of what it means to execute a list of addresses, what happens when a twig routine calls another twig routine? In order to interpret the list of addresses in the *called* twig routine we have to set IP to point to the *first* of the list of addresses and then run NEXT. But at that moment IP points to the place in the callers list of addresses that we should return to, and we dont want to clobber it, otherwise we would “lose our place” in the execution of the calling twig routine.
Thus, before setting IP to point to the first address in the called word, we have to push the callers IP onto our call stack.
And this is *precisely* the code that the header of our twig routine calls. I call it **NEST**. It is often called **DOCOLON** (for reasons that should become clear later).
The dual of this the special “exit” routine alluded to above, the address of which ends every list of addresses in a twig routine I call **UNNEST**. It pops the previous IP off the call stack, and then runs NEXT, thus resuming interpretation in the calling twig routine. (Many Forths call this **EXIT**, for obvious reasons.)
We have all the pieces now, but a few questions remain. Where is NEXT? And *what* is NEXT?
We can do another thought experiment. Lets say we are executing NEST. We push the callers IP, set IP to point to the first address in our called twig routine... And then what? Do we return? If so, to what? There isnt a “main” machine code routine to return to. Weirdly, there isnt a loop somewhere that repeatedly executes NEXT. Instead, NEXT is *everywhere*.
Every leaf routine ends, not with a return instruction, but with NEXT. NEST ends with NEXT. UNNEST ends with NEXT.
To “fire up” this interpreter, all we have to do is set IP to point somewhere, and then execute NEXT. Any NEXT. Anywhere. At this point, our threaded code interpreter is off and running.
To recap: We need three small routines to make all this work: NEXT, NEST, and UNNEST.
```
NEXT: Fetch the address pointed to by IP
Increment IP by address size
Jump to fetched address
```
```
NEST: Push IP onto call stack
Set IP to point to the first address of the called twig routine
Execute NEXT
```
```
UNNEST: Pop IP from call stack
Execute NEXT
```
Because NEXT is short often one to three instructions it is usually copied inline into the body of NEST, UNNEST, and any other leaf routines.
### [Direct-threaded code (DTC)](#direct-threaded-code-dtc)
What I have just described is usually referred to as *direct-threaded code* (DTC). It is *direct* because NEXT jumps directly to the address fetched from the list of addresses that make up the body of a twig routine.
Because Forth has two stacks a data (or parameter) stack, and a return (or call) stack, we should be clear that NEST and UNNEST push and pop the *return* stack (often called the R stack). In fact, I dont see how this threading model can work with a single stack.
(Side note: Forths call stack and the machines call stack do not have to be the same! And often they are not. If the machine has push and pop operations it is usually more efficient to use the machines call stack as the Forth data stack, and to put the Forth call stack (the return, or “R” stack) somewhere else.)
Its not clear from my description above how NEST computes the new IP (the address of the first address in the list). There are two ways to do it.
If the “header” of the twig routine is a *call* to NEST, then NEST can pop the (machines) call stack. The popped address will be the address of the first address in the list. (This is the semantics of any call instruction: push the following address onto the machines call stack, then jump to the destination. We are “misusing” call to push the address of the list of addresses, which immediately follow the call in memory.)
But there is another way, and its often more efficient. We designate another pointer register often called W (for “word”, as pieces of Forth code are usually referred to as “words”) for use by NEXT and NEST, and modify them thus:
```
NEXT: Fetch into W the address pointed to by IP
Increment IP by address size
Jump to W
```
```
NEST: Push IP onto call stack
Set IP to W + sizeof(Jump)
Execute NEXT
```
Now the “call NEST” is replaced by “jump NEST” in the twig routines header. Since W points to the header, by offseting it (by the size of the jump instruction), we can calculate the address of the first address in the list, which directly follows the jump to NEST. We set IP to this address.
Our two kinds of words leaf and twig now look like this:
```
leaf word twig word
~~~~~~~~~ ~~~~~~~~~
machine code jump NEST
machine code address 1
... address 2
machine code ...
NEXT address n
address of UNNEST
```
When NEXT executes a leaf word, that “Jump to W” jumps directly to machine code. But when it executes a twig word, it jumps to a jump. We all know how terrible this is! Pipeline refill time!
What if we replaced this “code indirection” a jump to a jump with a *data* indirection?
Enter...
### [Indirect-threaded code (ITC)](#indirect-threaded-code-itc)
By replacing the jump NEST (or call NEST) instruction at the beginning of every twig word with a *pointer* to NEST, and by adding an indirection to NEXT:
```
NEXT: Fetch into W the address pointed to by IP
Increment IP by address size
Fetch into X the address pointed to by W
Jump to X
```
and by making a small change to NEST:
```
NEST: Push IP onto call stack
Set IP to W + address size
Execute NEXT
```
we arrive at indirect-threaded code, also known as ITC.
Remember: DTC is *direct* because NEXT jumps directly to the address fetched from the list of addresses that make up the body of a twig routine.
Thus: ITC is *indirect* because NEXT jumps indirectly *through* the address fetched from the list of addresses that make up the body of a twig routine.
Ive written the above version of ITC NEXT the way you would write it for a RISC machine. A CISC machine with auto-increment addressing can collapse the first two instructions into one; one with indirect addressing can collapse the last two into one.
ITC NEXT is two instructions on the MSP430, and four basically the four steps outlined above on RISC-V.
There is another change we need to make for indirect threading to work. With DTC the bodies of both leaf and twig words started with *machine code*; with ITC, the bodies of both have to start with a *pointer to machine code*.
Which means we have to change our leaf words for ITC. We add a machine code pointer that simply points to the code that follows it.
```
leaf word twig word
+----------+ +----------+
| addr |---+ | addr |-------> NEST
+----------+ | +----------+
machine code <-+ address 1
machine code address 2
... ...
machine code address n
NEXT address of UNNEST
```
### [Useful nomenclature](#useful-nomenclature)
Since its tricky to explain all this, its useful to have a common vocabulary when talking about threading and the structure of words in a threaded system. Again, since its what Im familiar with, Im going to use the Forth terminology.
The machine code pointer at the start of every word in an ITC system is called a **code pointer**.
That first slot of a word in both ITC and DTC systems is called the **code field**, and the body that follows machine code in the case of a leaf word, and addresses in a twig word is called the **parameter field**.
Leaf words are called **code** words, and twig words are called **colon** words. These names come from the Forth words that construct them: `code` and `:`.
Since we would like to be able to think and talk clearly about indirection, we give names to two important addresses:
* The address of a code field is called, unsurprisingly, a **code field address** usually abbreviated **cfa**.
* The address of a parameter field is called, also unsurprisingly, a **parameter field address** usually abbreviated **pfa**.
In a DTC system, a cfa points to a code field, which *contains* machine code.
In an ITC system, a cfa points to a code field, which *points to* machine code.
In both cases, the addresses in the body (parameter field) of a colon word (twig word) are all cfas. (Note: Its possible to use pfas instead, and [there are good reasons to do this](/threaded-code-variations/).
### [Everything is executable!](#everything-is-executable)
We are not yet at the end of our story!
It turns out that code and colon (leaf and twig) words are *not* the only kinds of words in a threaded code system. What about data?
Ill use the examples of two common Forth data types: variables and constants
While there are probably other approaches, on threaded Forth systems everything in the system including data types! has executable behavior. You can and indeed *must* execute *everything*. (Curiously, in this way a threaded Forth is somewhat like Lisp: code and data are isomorphic.)
What might it mean to *execute* a variable or a constant? Lets start with constants, since they are simpler (though both are straightforward).
A constant pushes its value onto the data stack. Thats it!
Can we turn this *idea* of a constant into a structure in memory that will work with our threaded interpreter? After defining a constant called `hex-fives` with the value 5555\_5555, we would have the following representation in memory:
```
DTC ITC
hex-fives hex-fives
~~~~~~~~~ ~~~~~~~~~
jump to CONSTANT address of CONSTANT (code field)
5555_5555 5555_5555 (parameter field)
```
In both cases DTC and ITC the representation consists of a code field and a parameter field just like code and colon words. Whereas colon words have a code field that refers to NEST, constants have a code field that refers to CONSTANT, which looks like this:
```
CONSTANT: Add to W the size of the code field (calculate pfa)
Fetch value pointed to by W into W (fetch contents)
Push W onto the data stack
Execute NEXT
```
Remember that after executing NEXT, W contains a cfa: it points to the code field, *not* the parameter field. (Actually, this isnt [written in stone](/threaded-code-variations/).)
If we use `hex-fives` in a colon word, it gets compiled like any other word. To add `hex-fives` to the value on the top of the data stack, we would compile the following address list:
```
address of hex-fives
address of +
```
Variables are only slightly more complicated. Variables in Forth are treated like ML references: you have to explicitly dereference them. There are two words to do this: `@` (“fetch”) and `!` (“store”). `@` consumes an address from the data stack, fetches its value from memory, and pushes that value onto to the data stack; `!` consumes a value and an address from the data stack, and stores the value at that address in memory.
What does a variable *do*? It pushes the *address* of its value onto the data stack.
Variables look like this:
```
DTC ITC
radix radix
~~~~~~~~~ ~~~~~~~~~
jump to VARIABLE address of VARIABLE (code field)
2 2 (parameter field)
```
Here we have a variable called “radix” with the current value 2 (we are in binary).
The code that all variables execute is remarkably similar to CONSTANT. Where CONSTANT pushed *value* stored in the parameter field, VARIABLE pushes the *address* of the parameter field the **pfa**.
```
VARIABLE: Add to W the size of the code field (calculate pfa)
Push W onto the data stack (push pfa)
Execute NEXT
```
Simple examples:
```
radix @
```
fetches the current value;
```
10 radix !
```
changes the radix to 10 (now we are in decimal).
It is out of the scope of this discussion, but every Forth system has mechanisms for creating new kinds of data with their own, specific execution behaviors.
### [Threaded code advantages](#threaded-code-advantages)
Elegance, simplicity, uniformity, code density.
Its quite easy to bring up a threaded-code implementation on a new architecture, and, once running, high-level tools written for a completely different architecture are likely to work unmodified, or with very small modifications.
The structural uniformity makes it very easy to extend and modify *without changing the underlying implementation*. I can add new data structures and new control structures at will without modifying the core compiler.
Because we cannot inline code, everything becomes a separate word. This has an interesting side effect: it aggressively removes *redundancy* from programs, which tend to become much smaller.
On occasion, threading is actually *faster* than native code. In native code a subroutine call requires the equivalent of two jumps: the call, and the return. On pipelined machines these can take several cycles.
When executing code words in a threaded system, only *one* jump is required! Only *one* execution of NEXT is required to execute a word. As a result, on some systems, DTC can be faster than call/return, and ITC is often no worse than call/return (but much more powerful).
### [Threaded code disadvantages](#threaded-code-disadvantages)
Speed, and, sometimes, size.
Since we lose the ablitily to do any kind of code inlining, even simple things like “add these two numbers” have to be written as separate routines and “called” via NEXT. This is obviously slower than inlining.
In terms of size, on processors where an instruction is smaller than an address eg, on 32-bit machines with 16-bit instructions native code can sometimes be denser, but generally the “deduplication” that threading encourages will offset this.
### [Conclusions](#conclusions)
Threaded code is an extraordinarily simple and elegant way to implement language interpreters. Compared to bytecoded interpreters it is quite fast, and compilers for it are essentially trivial.
Because it creates a system entirely composed of uniform pieces, extensibility of the system by users is almost unlimited, and building generic tools is dramatically simplified!
All this for a modest execution time penalty... ;-)
### [To explore further](#to-explore-further)
Read about [threaded code variations](/threaded-code-variations/). I talk about why sometimes it makes sense to put pfas rather than cfas into address lists (colon word bodies).
Read about [literals, ifs, and loops](/threaded-code-literals-ifs-and-loops/) in threaded code systems. Ive suggested here that all colon words consist of a list of addresses that are executed in sequence. Real code branches and loops. And uses literal numbers.
Read about the [difference between a “call” instruction and a “branch-and-link” instruction](/call-versus-branch-and-link/), and how both relate to threaded code.
---
[Send feedback](/cdn-cgi/l/email-protection#3b1e0c0c1e0d0e1e0d091e0d031e0d0a1e0d5f1e0c081e0c0f1e0d0e1e0c091e0f0b1e0d5e1e0d021e0d5f1e0d091e0d581e0d0e1e0d5f1e0d0a1e0d081e0d031e0d021e0d5e1e0d0e1e0c081e095e1e0d081e0d5d1e0d5f04484e59515e584f061e0e59564e5d54494f531e0e5f1e090b6f53495e5a5f5e5f1e090b58545f5e) on this page (last edited 2021 June 07)
Browse [all pages](/all-pages/)
Return [home](/)

View File

@@ -0,0 +1,117 @@
# Variations
**Source:** https://muforth.dev/threaded-code-variations/
Threaded code: Variations muforth
# Threaded code: Variations
---
### [Address lists: cfas or pfas?](#address-lists:-cfas-or-pfas)
In my introduction to [threaded code](/threaded-code/) I mentioned that colon word bodies consist of a list of cfas (code field addresses), but that sometimes it makes sense to use pfas instead. We are going to explore that idea here.
First, lets recap the definitions:
The address of a code field is called, unsurprisingly, a **code field address** usually abbreviated **cfa**.
The address of a parameter field is called, also unsurprisingly, a **parameter field address** usually abbreviated **pfa**.
In a DTC system, a cfa points to a code field, which *contains* machine code.
In an ITC system, a cfa points to a code field, which *points to* machine code.
The main reason for using cfas in address lists is that its the *obvious* thing to do. The cfa points to the code field, which we either jump *to* (DTC) or jump *through* (ITC). Why would we want to use anything else?
The answer is suggested not by the code of NEXT, but by NEST, VARIABLE, and CONSTANT the “runtime” routines for colon words, variables, and constants, respectively. Lets look at them again:
```
DTC_NEST: Push IP onto call stack
Set IP to W + sizeof(Jump)
Execute NEXT
```
```
ITC_NEST: Push IP onto call stack
Set IP to W + address size
Execute NEXT
```
```
VARIABLE: Add to W the size of the code field (ie, calculate pfa)
Push W onto the data stack (push pfa)
Execute NEXT
```
```
CONSTANT: Add to W the size of the code field (calculate pfa)
Fetch value pointed to by W into W (fetch contents of parameter field)
Push W onto the data stack
Execute NEXT
```
Whether calculating the new IP in NEST, or calculating the address of the value in VARIABLE and CONSTANT, we are always adding an offset to W. Because of how NEXT works, W contains the cfa. We want the pfa.
Whenever a programmer creates a new data type that has an assembler runtime (using `;code`) they have to do this same arithmetic on W. Why not do it one place?
The natural “one place” is in NEXT. So what would we change? Our aim is to exit NEXT with W containing a pfa instead of a cfa.
Lets look at DTC first. Here is DTC NEXT:
```
NEXT: Fetch into W the address pointed to by IP
Increment IP by address size
Jump to W
```
We have conflicting requirements here. For DTC we have to jump *to* the code field. We have no choice there. But somehow we want W to point to the parameter field one memory cell higher. How to do both?
If the address list contains cfas, then the first step of NEXT will put a cfa into W. Can we jump to W and increment it in one instruction? Not likely.
What about using pfas in the address list. Does this help? W will have the right value when we exit from NEXT, but can we jump to W minus an offset? It depends on the machine. And it might make NEXT longer possibly significantly longer.
On some machines the best way to do DTC NEXT doesnt involve W at all. For example, on the MSP430 the shortest DTC NEXT is one instruction:
```
mov pc, (ip)+
```
This does the auto-increment of IP and the jump to the fetched cfa, but leaves to the runtimes the computation of the pfa. This approach requires that code fields contain *calls* rather than *jumps* in order to “capture” the pfa somewhere (it gets pushed onto the machines call stack).
DTC doesnt offer a lot of wiggle room. Maybe ITC is better. Lets take a look.
Here is ITC NEXT:
```
NEXT: Fetch into W the address pointed to by IP
Increment IP by address size
Fetch into X the address pointed to by W
Jump to X
```
As we did with DTC, lets start with the case where address lists contain cfas. Just as with DTC NEXT, the first step of ITC NEXT loads a cfa into W. On a machine with auto-increment addressing we can have the “Fetch into X” step increment W so that when we get to NEST (or one of the other “runtimes”) W will contain the pfa.
It might take an extra cycle (it does on the MSP430) but because in every case except executing a code word we will have to take at least a cycle to do arithmetic on W, it might make sense to auto-increment instead. Its also less error-prone to do it, correctly, in one place. (This is what I have done in the MSP430 ITC kernel.)
If we *dont* have auto-increment (eg, most true RISC machines ARM (excepting v6-M) doesnt count ;-) but can use a *negative offset* in our memory access instructions, then it makes sense to use pfas in our address lists instead of cfas. If we do this, the first step of NEXT loads W with a pfa, which is what we want. But the “Fetch into X” step needs to load from the cfa instead, so we offset *backwards* by the size of an address. This sounds convoluted, but its actually the most efficient approach.
Here is that version of ITC NEXT:
```
NEXT: Fetch into W the address pointed to by IP (this is a pfa, not a cfa!)
Increment IP by address size
Fetch into X the address pointed to by (W - address size)
Jump to X
```
This is what I have done for the RISC-V ITC NEXT.
You have to work *with* the strengths and *against* the weaknesses of your architecture not the other way around! There is no fixed answer. Using cfas is not always the “perfect and beautiful” approach. Nor is using pfas. It pays to tinker and draw pictures and pay attention to instruction cycle-times and sizes.
---
[Send feedback](/cdn-cgi/l/email-protection#0c293b3b293a39293a3e293a34293a3d293a68293b3f293b38293a39293b3e29383c293a69293a35293a68293a3e293a6f293a39293a68293a3d293a3f293a34293a35293a69293a39293b3f293e69293a3f293a6a293a68337f796e66696f783129396e61796a637e7864293968293e3c58647e696d686968293e3c6f636869293f6d293e3c5a6d7e656d786563627f) on this page (last edited 2017 April 24)
Browse [all pages](/all-pages/)
Return [home](/)

View File

@@ -0,0 +1,17 @@
# Website
**Source:** https://wiki.c2.com
**notice**
javascript required to view this site
**why**
measured improvement in server performance
awesome incremental search
![](spin.gif)
This site uses features not available in older browsers.

View File

@@ -0,0 +1,158 @@
# Website - Bit Test Complement
**Source:** https://onatto.github.io/lang.html
Bit Test Complement
Bit Test Complement
[Home](index.html)
[Language](lang.html)
[Journey](journey.html)
[Art](videos.html)
[Blog](blog.html)
## The Kyra Language
```
Kyra is an avant-garde concatenative language, built with entirely different principles from status quo and other forth-like languages.
The language is incredibly efficient for those who know how to wield it, I really can't go back to coding in C-like for personal stuff anymore.
It's a foundational meta-language built from first-principles, doesn't make any assumptions about runtime or the problems it solves.
It molds into whatever language needs to exist to solve given problems freely and usually much more efficiently than in other languages.
It builds on a simple design I got inspired from Timothy Lottes, an enigmatic legendary coder who understood Forth philosophy more than any.
The core idea is to invent new 'languages' to generate whatever we need to solve the problem at hand.
Concatenative nature lets compose words naturally, can invent a comfortable language whatever the problem is.
Programming is still stuck with cruft of the old, while having long forgotten important wisdom of the old, namely the Forth philosophy.
This philosophy piqued my curiousity around 2017, I didn't understand it fully until I built and coded a lot in Kyra.
I don't think most people who've coded in Forth understand it either.
They're either thinking too complex from implementation or philosophy perspective, mostly stuck in dogma from the past.
Coming from the C paradigm, coding freeform like this without any rules is already hard, it's especially hard without a proper IDE.
It's also quite unsafe, no types, no safety-belts, which are unnecessary anyway, although the world disagrees with this.
The compiler is implemented in 1800 bytes of x64 assembly, rest of the IDE is written in C, soon to be bootstrapped.
The editor uses compute-only Vulkan with GPA profiling for AMD, utilizing GPU pointers and bindless.
![](stuff/html.png)
Even this sites HTML/CSS is defined/generated in Kyra
![](stuff/markdown.png)
Custom Markdown-like lite language for content, freeform, parsed in Kyra generating HTML
```
## Conciseness/Expressivity
```
The language lets writing code as concise as possible from scratch, usually much more so than other languages.
Here's some figures for a codebase totalling 4K lines of code, no cheating via external/stdlib code:
- Complete x64 assembler, fastest in the world, in only 192 lines
- All base instructions, all SSE instructions without VEX-prefix, all addressing modes including RIP-relative
- Tiny in size, generated 194 instructions/756 bytes of x64 code + 3KB for instruction descriptor tables
- Hyper-optimized, millions of instructions generated per second per core
- Ryzen5900HX @3.6Ghz: 180M instr/second/core
- Ryzen1700X @3.4Ghz: 105M instr/second/core
- Ryzen2500U @2.0Ghz: 80M instr/second/core
- Compute-only SPIRV assembler with type checking and swizzles in 768 lines, rust-gpu is 23k lines in comparison
- Compiling shaders in <5ms (cached, mostly driver validation overhead) by generating SPIR-V fed to the driver directly
This bypasses glslang > file.out > hotload > fread > driver overhead entirely, which is ~100x faster.
- Line-based SDF font renderer 128 lines, custom font definition in 192 lines.
- HTML/CSS language which this site is generated in, totaling 448 lines along with a simple markdown-like format
- Building this whole site takes <10ms, most of it spent on file I/O
- Self-Gravitational Spin Systems in 256 lines defining 4 shaders
```
## Instant Iteration
```
Ideally everything should be instant: compiling, editing, testing, visualization, debugging, intellisense...
Currently my code compiles around 1-2 ms unless I'm dealing with external code such as the Vulkan driver or Capstone.
Less than 10ms iteration times(less than a frame) makes even 1 second feel like an eternity.
Instead of taking large steps, I take small steps which leads to a lot less bugs with instant testing.
I once had compiles go up to 5ms, profiled to understand why(thousand paper cuts), then optimized it back to 1ms in assembly.
This might seem extreme but performance regressions are cumulative, they're best profiled, understood and solved when they surface.
So when I see other languages compiling in seconds up to a minute I feel sad that no one thinks this is a big problem.
As usual with the attitude of programmers towards performance, compile-time performance too gets swept under the rug to be solved later.
Which is the worst time to solve this problem because you're left speculating where the papercuts may be after big offenders are gone.
Actually even 1ms is relatively long, in the next iteration of the language I plan to bring this down to sub-millisecond range.
```
## Performance/Optimizability
```
Optimal performance means squeezing every bit of given hardware instead of relying on compilers to generate good code.
Optimal performance everywhere doesn't matter when most code will be cold, so we can afford to generate less than optimal code.
When code is hot, we need to be consistently reason about the generated code instead of having to check if compiler is being stupid.
I eventually figured out optimal performance from a high-level representation is essentially impossible, it's literally an AI problem.
No compiler can hope to write generate as good as handwritten assembly by a coder who knows what they're doing in total control.
What matters is that code remains optimizable instead of magic optimizations applied everywhere, I want less magic, more control/optimizability.
Optimal register allocation across functions is unnecesarily complex and unreliable, a human mind can do this way better and reliable than a compiler.
Trying to be optimal regarding spills(3ns each) here and there won't help performance unless that code is hot.
Although thousand paper cuts kills performance real quick, it's bad to be equally slow everywhere, like having a stack machine or garbage collection.
```
## Profiling
```
Crucial to performance, we need to be able to profile a section or entirety of our codebase, continously and instantly within the IDE.
Continous profiling is especially crucial to track down performance regressions instead of trying to fix them later.
I use inline RDTSC for extreme fine-grained CPU profiling, sokol_time is quite nice/minimal for coarse-grained.
I've got integrated GPU profiling via AMD GPA.
Also examining generated GPU assembly is illuminating both for performance, debugging or getting angry at compilers shipped in drivers.
```
## Crash Resilience
```
Integrating the IDE and the app into a single program for instant-iteration is great until you hard-crash, which breaks the flow.
With crash-resilence the IDE not only survives the (soft)crash but also gives a full callstack.
This is especially necessary for environments like in VR where a crash is catastrophic, restart takes longer than desktop.
```
## Debuggability
```
Instant iteration makes debugging mostly trivial when workflow is making small changes followed by testing immediately.
There can be only few things going wrong with this kind of workflow, it works out quite well so I don't need much debugging.
Although sometimes things will go wrong and even with crash-resilience the IDE crashes.
This isn't too bad as it takes <1s to restart, still somewhat annoying once I've gotten used to not hard-crashing at all.
The debugger is still in research, I'll probably eventually write an external debugger, didn't have to so far.
Need disassembly+register dump for the crash site, that mostly gives enough of an idea how things have gone wrong.
```
## Visulization
```
Visualization is fundamental, before any output happens we've no idea whether the code we've written actually works.
A lot of the time in programming is spent on writing printfs just so we can understand what is going on.
With instant-iteration, having a few words which help with visualisation is good enough but this kind of UX can be vastly improved.
I still haven't implemented the ultimate immediate no-code visualization yet, I have a few approaches for the next iteration.
```
## Navigability
```
Also called 'intellisense', I can jump instantly to the definition and occurances of a word/variable, solved elegantly requiring minimal energy.
I can even visualize with a single word in which order given words are executed, quite handy and lacking in other languages.
However, I don't have code completion because it's not needed when most words are quite short.
```
## Version Control
```
The current IDE features custom builtin version control with up to 512 undo/redos for each version, no merge, single branch, quite good for a single developer.
I've got a few ideas for a version control system that works with multiple developers, no time or need to implement it yet.
```

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,804 @@
# Wikipedia Page
**Source:** https://en.wikipedia.org/wiki/Forth_(programming_language)
Forth (programming language) - Wikipedia
[Jump to content](#bodyContent)
Main menu
Main menu
move to sidebar
hide
Navigation
* [Main page](/wiki/Main_Page "Visit the main page [z]")
* [Contents](/wiki/Wikipedia:Contents "Guides to browsing Wikipedia")
* [Current events](/wiki/Portal:Current_events "Articles related to current events")
* [Random article](/wiki/Special:Random "Visit a randomly selected article [x]")
* [About Wikipedia](/wiki/Wikipedia:About "Learn about Wikipedia and how it works")
* [Contact us](//en.wikipedia.org/wiki/Wikipedia:Contact_us "How to contact Wikipedia")
Contribute
* [Help](/wiki/Help:Contents "Guidance on how to use and edit Wikipedia")
* [Learn to edit](/wiki/Help:Introduction "Learn how to edit Wikipedia")
* [Community portal](/wiki/Wikipedia:Community_portal "The hub for editors")
* [Recent changes](/wiki/Special:RecentChanges "A list of recent changes to Wikipedia [r]")
* [Upload file](/wiki/Wikipedia:File_upload_wizard "Add images or other media for use on Wikipedia")
* [Special pages](/wiki/Special:SpecialPages "A list of all special pages [q]")
[![](/static/images/icons/enwiki-25.svg)
![Wikipedia](/static/images/mobile/copyright/wikipedia-wordmark-en-25.svg)
![The Free Encyclopedia](/static/images/mobile/copyright/wikipedia-tagline-en-25.svg)](/wiki/Main_Page)
[Search](/wiki/Special:Search "Search Wikipedia [f]")
Search
Appearance
* [Donate](https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en)
* [Create account](/w/index.php?title=Special:CreateAccount&returnto=Forth+%28programming+language%29 "You are encouraged to create an account and log in; however, it is not mandatory")
* [Log in](/w/index.php?title=Special:UserLogin&returnto=Forth+%28programming+language%29 "You're encouraged to log in; however, it's not mandatory. [o]")
Personal tools
* [Donate](https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en)
* [Create account](/w/index.php?title=Special:CreateAccount&returnto=Forth+%28programming+language%29 "You are encouraged to create an account and log in; however, it is not mandatory")
* [Log in](/w/index.php?title=Special:UserLogin&returnto=Forth+%28programming+language%29 "You're encouraged to log in; however, it's not mandatory. [o]")
## Contents
move to sidebar
hide
* [(Top)](#)
* [1
Uses](#Uses)
* [2
History](#History)
* [3
Overview](#Overview)
* [4
Facilities](#Facilities)
Toggle Facilities subsection
+ [4.1
Operating system, files, and multitasking](#Operating_system,_files,_and_multitasking)
+ [4.2
Self-compilation and cross compilation](#Self-compilation_and_cross_compilation)
* [5
Structure of the language](#Structure_of_the_language)
Toggle Structure of the language subsection
+ [5.1
Structure of the compiler](#Structure_of_the_compiler)
- [5.1.1
Compilation state and interpretation state](#Compilation_state_and_interpretation_state)
- [5.1.2
Immediate words](#Immediate_words)
- [5.1.3
Unnamed words and execution tokens](#Unnamed_words_and_execution_tokens)
- [5.1.4
Parsing words and comments](#Parsing_words_and_comments)
+ [5.2
Structure of code](#Structure_of_code)
+ [5.3
Data objects](#Data_objects)
* [6
Examples](#Examples)
Toggle Examples subsection
+ [6.1
“Hello, World!”](#“Hello,_World!”)
+ [6.2
Mixing states of compiling and interpreting](#Mixing_states_of_compiling_and_interpreting)
+ [6.3
RC4 cipher program](#RC4_cipher_program)
* [7
Forth engines](#Forth_engines)
* [8
Implementations](#Implementations)
* [9
See also](#See_also)
* [10
Notes](#Notes)
* [11
References](#References)
* [12
External links](#External_links)
Toggle the table of contents
# Forth (programming language)
34 languages
* [中文](https://zh.wikipedia.org/wiki/Forth "Forth Chinese")
* [Кыргызча](https://ky.wikipedia.org/wiki/%D0%A4%D0%BE%D1%80%D1%82_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B0%D0%BB%D0%BE%D0%BE_%D1%82%D0%B8%D0%BB%D0%B8) "Форт (программалоо тили) Kyrgyz")
* [한국어](https://ko.wikipedia.org/wiki/%ED%8F%AC%EC%8A%A4_(%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D_%EC%96%B8%EC%96%B4) "포스 (프로그래밍 언어) Korean")
* [Français](https://fr.wikipedia.org/wiki/Forth_(langage) "Forth (langage) French")
* [Español](https://es.wikipedia.org/wiki/Forth "Forth Spanish")
* [Magyar](https://hu.wikipedia.org/wiki/Forth_(programoz%C3%A1si_nyelv) "Forth (programozási nyelv) Hungarian")
* [Italiano](https://it.wikipedia.org/wiki/Forth_(linguaggio) "Forth (linguaggio) Italian")
* [Galego](https://gl.wikipedia.org/wiki/Forth "Forth Galician")
* [Deutsch](https://de.wikipedia.org/wiki/Forth_(Programmiersprache) "Forth (Programmiersprache) German")
* [日本語](https://ja.wikipedia.org/wiki/Forth "Forth Japanese")
* [Ελληνικά](https://el.wikipedia.org/wiki/Forth "Forth Greek")
* [Simple English](https://simple.wikipedia.org/wiki/Forth "Forth Simple English")
* [العربية](https://ar.wikipedia.org/wiki/%D9%81%D9%88%D8%B1%D8%AB_(%D9%84%D8%BA%D8%A9_%D8%A8%D8%B1%D9%85%D8%AC%D8%A9) "فورث (لغة برمجة) Arabic")
* [Nederlands](https://nl.wikipedia.org/wiki/Forth_(programmeertaal) "Forth (programmeertaal) Dutch")
* [Svenska](https://sv.wikipedia.org/wiki/Forth_(programspr%C3%A5k) "Forth (programspråk) Swedish")
* [Português](https://pt.wikipedia.org/wiki/Forth "Forth Portuguese")
* [Esperanto](https://eo.wikipedia.org/wiki/Forth_(programlingvo) "Forth (programlingvo) Esperanto")
* [Тоҷикӣ](https://tg.wikipedia.org/wiki/Forth "Forth Tajik")
* [Русский](https://ru.wikipedia.org/wiki/%D0%A4%D0%BE%D1%80%D1%82_(%D1%8F%D0%B7%D1%8B%D0%BA_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F) "Форт (язык программирования) Russian")
* [Norsk bokmål](https://no.wikipedia.org/wiki/Forth_(programmeringsspr%C3%A5k) "Forth (programmeringsspråk) Norwegian Bokmål")
* [Català](https://ca.wikipedia.org/wiki/Forth "Forth Catalan")
* [Suomi](https://fi.wikipedia.org/wiki/Forth_(ohjelmointikieli) "Forth (ohjelmointikieli) Finnish")
* [Українська](https://uk.wikipedia.org/wiki/Forth "Forth Ukrainian")
* [Čeština](https://cs.wikipedia.org/wiki/Forth_(programovac%C3%AD_jazyk) "Forth (programovací jazyk) Czech")
* [Български](https://bg.wikipedia.org/wiki/Forth "Forth Bulgarian")
* [Interlingua](https://ia.wikipedia.org/wiki/Forth_(linguage_de_programmation) "Forth (linguage de programmation) Interlingua")
* [Беларуская](https://be.wikipedia.org/wiki/%D0%A4%D0%BE%D1%80%D1%82_(%D0%BC%D0%BE%D0%B2%D0%B0_%D0%BF%D1%80%D0%B0%D0%B3%D1%80%D0%B0%D0%BC%D0%B0%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F) "Форт (мова праграмавання) Belarusian")
* [Latviešu](https://lv.wikipedia.org/wiki/Forth_(programm%C4%93%C5%A1anas_valoda) "Forth (programmēšanas valoda) Latvian")
* [Српски / srpski](https://sr.wikipedia.org/wiki/Forth_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D1%81%D0%BA%D0%B8_%D1%98%D0%B5%D0%B7%D0%B8%D0%BA) "Forth (програмски језик) Serbian")
* [فارسی](https://fa.wikipedia.org/wiki/%D8%B2%D8%A8%D8%A7%D9%86_%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D9%87%E2%80%8C%D9%86%D9%88%DB%8C%D8%B3%DB%8C_%D9%81%D9%88%D8%B1%D8%AB "زبان برنامه‌نویسی فورث Persian")
* [Polski](https://pl.wikipedia.org/wiki/Forth_(j%C4%99zyk_programowania) "Forth (język programowania) Polish")
* [粵語](https://zh-yue.wikipedia.org/wiki/Forth "Forth Cantonese")
* [Slovenščina](https://sl.wikipedia.org/wiki/Forth_(programski_jezik) "Forth (programski jezik) Slovenian")
* [ꠍꠤꠟꠐꠤ](https://syl.wikipedia.org/wiki/%EA%A0%9A%EA%A0%9E%EA%A0%86%EA%A0%95 "ꠚꠞ꠆ꠕ Sylheti")
[Edit links](https://www.wikidata.org/wiki/Special:EntityPage/Q275472#sitelinks-wikipedia "Edit interlanguage links")
* [Article](/wiki/Forth_(programming_language) "View the content page [c]")
* [Talk](/wiki/Talk:Forth_(programming_language) "Discuss improvements to the content page [t]")
English
* [Read](/wiki/Forth_(programming_language))
* [Edit](/w/index.php?title=Forth_(programming_language)&action=edit "Edit this page [e]")
* [View history](/w/index.php?title=Forth_(programming_language)&action=history "Past revisions of this page [h]")
Tools
Tools
move to sidebar
hide
Actions
* [Read](/wiki/Forth_(programming_language))
* [Edit](/w/index.php?title=Forth_(programming_language)&action=edit "Edit this page [e]")
* [View history](/w/index.php?title=Forth_(programming_language)&action=history)
General
* [What links here](/wiki/Special:WhatLinksHere/Forth_(programming_language) "List of all English Wikipedia pages containing links to this page [j]")
* [Related changes](/wiki/Special:RecentChangesLinked/Forth_(programming_language) "Recent changes in pages linked from this page [k]")
* [Upload file](//en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard "Upload files [u]")
* [Permanent link](/w/index.php?title=Forth_(programming_language)&oldid=1330667744 "Permanent link to this revision of this page")
* [Page information](/w/index.php?title=Forth_(programming_language)&action=info "More information about this page")
* [Cite this page](/w/index.php?title=Special:CiteThisPage&page=Forth_%28programming_language%29&id=1330667744&wpFormIdentifier=titleform "Information on how to cite this page")
* [Get shortened URL](/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FForth_%28programming_language%29)
* [Download QR code](/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FForth_%28programming_language%29)
Print/export
* [Download as PDF](/w/index.php?title=Special:DownloadAsPdf&page=Forth_%28programming_language%29&action=show-download-screen "Download this page as a PDF file")
* [Printable version](/w/index.php?title=Forth_(programming_language)&printable=yes "Printable version of this page [p]")
In other projects
* [Wikimedia Commons](https://commons.wikimedia.org/wiki/Category:Forth_(programming_language))
* [Wikibooks](https://en.wikibooks.org/wiki/Forth)
* [Wikidata item](https://www.wikidata.org/wiki/Special:EntityPage/Q275472 "Structured data on this page hosted by Wikidata [g]")
Appearance
move to sidebar
hide
From Wikipedia, the free encyclopedia
Stack-based programming language
"FORTH" redirects here. For other uses, see [Forth (disambiguation)](/wiki/Forth_(disambiguation) "Forth (disambiguation)").
| Forth | |
| --- | --- |
| [Paradigm](/wiki/Programming_paradigm "Programming paradigm") | [concatenative](/wiki/Concatenative_programming_language "Concatenative programming language") ([stack-based](/wiki/Stack-oriented_programming "Stack-oriented programming")), [procedural](/wiki/Procedural_programming "Procedural programming"), [reflective](/wiki/Reflective_programming "Reflective programming") |
| [Designed by](/wiki/Software_design "Software design") | [Charles H. Moore](/wiki/Charles_H._Moore "Charles H. Moore") |
| First appeared | 1970; 56 years ago (1970) |
| [Typing discipline](/wiki/Type_system "Type system") | Typeless |
| [Filename extensions](/wiki/Filename_extension "Filename extension") | .fs, .fth, .4th, .f, .forth[*[citation needed](/wiki/Wikipedia:Citation_needed "Wikipedia:Citation needed")*] |
| Website | [forth-standard.org](https://forth-standard.org) |
| Major [implementations](/wiki/Programming_language_implementation "Programming language implementation") | |
| SwiftForth (Forth, Inc.) [Gforth](/wiki/Gforth "Gforth") (GNU Project) VFX Forth (MicroProcessor Engineering) | |
| Influenced | |
| [Bitcoin Script](/wiki/Bitcoin#Transactions "Bitcoin"), [Factor](/wiki/Factor_(programming_language) "Factor (programming language)"), [Joy](/wiki/Joy_(programming_language) "Joy (programming language)"), [RPL](/wiki/RPL_(programming_language) "RPL (programming language)"), [Rebol](/wiki/Rebol "Rebol"), [STOIC](/wiki/STOIC "STOIC"), [8th](/w/index.php?title=8th_(programming_language)&action=edit&redlink=1 "8th (programming language) (page does not exist)") | |
**Forth** is a [stack-oriented](/wiki/Stack-oriented_programming "Stack-oriented programming") [programming language](/wiki/Programming_language "Programming language") and interactive [integrated development environment](/wiki/Integrated_development_environment "Integrated development environment") designed by [Charles H. "Chuck" Moore](/wiki/Charles_H._Moore "Charles H. Moore") and first used by other programmers in 1970. Although not an [acronym](/wiki/Acronym "Acronym"), the language's name in its early years was often spelled in [all capital letters](/wiki/All_caps "All caps") as *FORTH*. The FORTH-79 and FORTH-83 implementations, which were not written by Moore, became *[de facto](/wiki/De_facto "De facto")* standards, and an official [technical standard](/wiki/Technical_standard "Technical standard") of the language was published in 1994 as ANS Forth. A wide range of Forth derivatives existed before and after ANS Forth. The [free and open-source software](/wiki/Free_and_open-source_software "Free and open-source software") [Gforth](/wiki/Gforth "Gforth") implementation is actively maintained, as are several [commercially](/wiki/Commercial_software "Commercial software") supported systems.
Forth typically combines a compiler with an integrated command shell, where the user interacts via [subroutines](/wiki/Subroutine "Subroutine") called *words*.[[a]](#cite_note-3)
Words can be defined, tested, redefined, and debugged without recompiling or restarting the whole program. All syntactic elements, including variables, operators, and control flow, are defined as words. A [stack](/wiki/Stack_(abstract_data_type) "Stack (abstract data type)") is used to pass parameters between words, leading to a [Reverse Polish notation](/wiki/Reverse_Polish_notation "Reverse Polish notation") style.
For much of Forth's existence, the standard technique was to compile to [threaded code](/wiki/Threaded_code "Threaded code"), which can be interpreted faster than [bytecode](/wiki/Bytecode "Bytecode"). One of the early benefits of Forth was size: an entire development environment—including compiler, editor, and user programs—could fit in memory on an 8-bit or similarly limited system. No longer constrained by space, there are modern implementations that generate [optimized](/wiki/Optimizing_compiler "Optimizing compiler") [machine code](/wiki/Machine_code "Machine code") like other language compilers.
The relative simplicity of creating a basic Forth system has led to many personal and proprietary variants, such as the custom Forth used to implement the bestselling 1986 video game *[Starflight](/wiki/Starflight "Starflight")* from [Electronic Arts](/wiki/Electronic_Arts "Electronic Arts").[[3]](#cite_note-maher-4) Forth is used in the [Open Firmware](/wiki/Open_Firmware "Open Firmware") [boot loader](/wiki/Boot_loader "Boot loader"), in [spaceflight](/wiki/Spaceflight "Spaceflight") applications[[4]](#cite_note-oSWRm-5) such as the [*Philae* spacecraft](/wiki/Philae_(spacecraft) "Philae (spacecraft)"),[[5]](#cite_note-zYmBe-6)[[6]](#cite_note-sgEMh-7) and in other embedded systems which involve interaction with hardware.
Beginning in the early 1980s, Moore developed a series of microprocessors for executing compiled Forth-like code directly and experimented with smaller languages based on Forth concepts, including cmForth and [colorForth](/wiki/ColorForth "ColorForth"). Most of these languages were created to support Moore's own projects, such as chip design.
## Uses
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=1 "Edit section: Uses")]
Forth has a niche in astronomical and space applications[[7]](#cite_note-C4Oss-8) as well as a history in [embedded systems](/wiki/Embedded_system "Embedded system"). The [Open Firmware](/wiki/Open_Firmware "Open Firmware") [boot ROMs](/wiki/Boot_ROM "Boot ROM") used by [Apple](/wiki/Apple_Inc. "Apple Inc."), [IBM](/wiki/IBM "IBM"), [Sun](/wiki/Sun_Microsystems "Sun Microsystems"), and [OLPC XO-1](/wiki/OLPC_XO "OLPC XO") contain a Forth environment.
Forth has often been used to bring up new hardware. Forth was the first [resident software](/wiki/Resident_monitor "Resident monitor") on the new [Intel 8086](/wiki/Intel_8086 "Intel 8086") chip in 1978, and MacFORTH was the first resident development system for the [Macintosh 128K](/wiki/Macintosh_128K "Macintosh 128K") in 1984.[[8]](#cite_note-evolution-9)
Circa 1982, [Atari, Inc.](/wiki/Atari,_Inc. "Atari, Inc.") used an elaborate animated demo written in Forth to showcase capabilities of the [Atari 8-bit computers](/wiki/Atari_8-bit_computers "Atari 8-bit computers") in department stores.[[9]](#cite_note-10) [Electronic Arts](/wiki/Electronic_Arts "Electronic Arts") published multiple video games in the 1980s that were written in Forth, including *[Worms?](/wiki/Worms%3F "Worms?")* (1983),[[10]](#cite_note-11) *[Adventure Construction Set](/wiki/Adventure_Construction_Set "Adventure Construction Set")* (1984),[[11]](#cite_note-12) *[Amnesia](/wiki/Amnesia_(1986_video_game) "Amnesia (1986 video game)")* (1986),[[12]](#cite_note-13) *[Starflight](/wiki/Starflight "Starflight")* (1986),[[3]](#cite_note-maher-4) and *[Lords of Conquest](/wiki/Lords_of_Conquest "Lords of Conquest")* (1986). Robot coding game *[ChipWits](/wiki/ChipWits "ChipWits")* (1984) was developed in MacFORTH for the [Macintosh 128K](/wiki/Macintosh_128K "Macintosh 128K"),[[13]](#cite_note-14) while the [Commodore 64](/wiki/Commodore_64 "Commodore 64") port was written with SuperForth 64.[[14]](#cite_note-15)
[Ashton-Tate's RapidFile](/wiki/Ashton-Tate#RapidFile "Ashton-Tate") (1986), a flat-file database program, and VP-Planner[[15]](#cite_note-16) from [Paperback Software International](/wiki/Paperback_Software_International "Paperback Software International") (1983), a spreadsheet program competing with [Lotus 1-2-3](/wiki/Lotus_1-2-3 "Lotus 1-2-3"), were written in Forth.
The [Canon Cat](/wiki/Canon_Cat "Canon Cat") (1987) uses Forth for its system programming.
[Rockwell](/wiki/Rockwell_International "Rockwell International") produced single-chip microcomputers with resident Forth kernels: the R65F11 and R65F12.
ASYST was a Forth expansion for measuring and controlling on PCs.[[16]](#cite_note-Rwirj-17)
## History
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=2 "Edit section: History")]
Forth evolved from [Charles H. Moore](/wiki/Charles_H._Moore "Charles H. Moore")'s personal programming system, which had been in continuous development since 1968.[[8]](#cite_note-evolution-9)[[17]](#cite_note-WYK4Z-18) Forth was first exposed to other programmers in the early 1970s, starting with [Elizabeth Rather](/wiki/Elizabeth_Rather "Elizabeth Rather") at the United States [National Radio Astronomy Observatory](/wiki/National_Radio_Astronomy_Observatory "National Radio Astronomy Observatory") (NRAO).[[8]](#cite_note-evolution-9) After their work at NRAO, Charles Moore and Elizabeth Rather formed FORTH, Inc. in 1973, refining and porting Forth systems to dozens of other platforms in the next decade.
Moore saw Forth as a successor to compile-link-go [third-generation programming languages](/wiki/Third-generation_programming_language "Third-generation programming language"), or software for "fourth generation" hardware. He recalls how the name was coined:[[18]](#cite_note-19)
> At [Mohasco](/wiki/Mohawk_Industries "Mohawk Industries") ["in the late 1960s"] I also worked directly on an [IBM 1130](/wiki/IBM_1130 "IBM 1130") interfaced with an [IBM 2250](/wiki/IBM_2250 "IBM 2250") graphics display. The 1130 was a very important computer: it had the first cartridge disk, as well as a card reader, a card punch (as backup for the disk), and a console typewriter. The 1130 let the programmer, for the first time, totally control the computer interactively.
> FORTH first appeared as an entity on that 1130. It was called F-O-R-T-H, a five-letter abbreviation of FOURTH, standing for fourth-generation computer language. That was the day, you may remember, of third-generation computers and I was going to leapfrog. But because FORTH ran on the 1130 (which permitted only five-character identifiers), the name was shortened.
FORTH, Inc.'s microFORTH was developed for the [Intel 8080](/wiki/Intel_8080 "Intel 8080"), [Motorola 6800](/wiki/Motorola_6800 "Motorola 6800"), [Zilog Z80](/wiki/Zilog_Z80 "Zilog Z80"), and [RCA 1802](/wiki/RCA_1802 "RCA 1802") microprocessors, starting in 1976. MicroFORTH was later used by hobbyists to generate Forth systems for other architectures, such as the [6502](/wiki/MOS_Technology_6502 "MOS Technology 6502") in 1978. The Forth Interest Group was formed in 1978.[[19]](#cite_note-20) It promoted and distributed its own version of the language, FIG-Forth, for most makes of home computer.
Forth was popular in the early 1980s,[[20]](#cite_note-1AvuY-21) because it was well suited to the limited memory of [microcomputers](/wiki/Microcomputer "Microcomputer"). The ease of implementing the language led to many implementations.[[21]](#cite_note-family-tree-22) The [Jupiter ACE](/wiki/Jupiter_Ace "Jupiter Ace") home computer has Forth in its [ROM](/wiki/Read-only_memory "Read-only memory")-resident operating system. Insoft GraFORTH is a version of Forth with graphics extensions for the Apple II.[[22]](#cite_note-gWyzb-23)
Common practice was codified in the de facto standards FORTH-79[[23]](#cite_note-qyrcN-24) and FORTH-83[[24]](#cite_note-BQ2oi-25) in the years 1979 and 1983, respectively. These standards were unified by [ANSI](/wiki/American_National_Standards_Institute "American National Standards Institute") in 1994, commonly referred to as ANS Forth.[[25]](#cite_note-IGDIN-26)[[26]](#cite_note-KojQK-27)
As of 2018, the source for the original 1130 version of FORTH has been recovered, and is now being updated to run on a restored or emulated 1130 system.[[27]](#cite_note-BtuRy-28)
## Overview
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=3 "Edit section: Overview")]
Further information: [Reverse Polish notation](/wiki/Reverse_Polish_notation "Reverse Polish notation")
Forth emphasizes the use of small, simple functions called *words*. Words for bigger tasks call upon many smaller words that each accomplish a distinct sub-task. A large Forth program is a hierarchy of words. These words, being distinct modules that communicate implicitly via a stack mechanism, can be prototyped, built and tested independently. The highest level of Forth code may resemble an English-language description of the application. Forth has been called a *meta-application language*: a language that can be used to create [problem-oriented languages](/wiki/Domain-specific_language "Domain-specific language").[[28]](#cite_note-29)
Forth relies on implicit use of a [data stack](/wiki/Stack_(abstract_data_type) "Stack (abstract data type)") and [reverse Polish notation](/wiki/Reverse_Polish_notation "Reverse Polish notation") which is commonly used in calculators from [Hewlett-Packard](/wiki/Hewlett-Packard "Hewlett-Packard"). In RPN, the operator is placed after its operands, as opposed to the more common [infix notation](/wiki/Infix_notation "Infix notation") where the operator is placed between its operands. Postfix notation makes the language easier to parse and extend; Forth's flexibility makes a static [BNF](/wiki/Backus-Naur_form "Backus-Naur form") grammar inappropriate, and it does not have a monolithic compiler. Extending the compiler only requires writing a new word, instead of modifying a grammar and changing the underlying implementation.
Using RPN, one can compute the value of the arithmetic expression (25 × 10) + 50 in the following way:
```
25 10 * 50 + CR .
300 ok
```
[![](//upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Stack1.svg/250px-Stack1.svg.png)](/wiki/File:Stack1.svg)
First the numbers 25 and 10 are put on the stack.
[![](//upload.wikimedia.org/wikipedia/commons/thumb/f/fd/Forthstack1_5.svg/250px-Forthstack1_5.svg.png)](/wiki/File:Forthstack1_5.svg)
The word `*` takes the top two numbers from the stack, multiplies them, and puts the product back on the stack.
[![](//upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Forthstack2.svg/250px-Forthstack2.svg.png)](/wiki/File:Forthstack2.svg)
Then the number 50 is placed on the stack.
[![](//upload.wikimedia.org/wikipedia/commons/thumb/6/64/Forthstack3.svg/250px-Forthstack3.svg.png)](/wiki/File:Forthstack3.svg)
The word `+` takes the top two numbers from the stack, adds them, and puts the sum back on the stack. `CR` ([carriage return](/wiki/Carriage_return "Carriage return")) starts the output on a new line. Finally, `.` prints the result. As everything has completed successfully, the Forth system prints `OK`.[[29]](#cite_note-3yqc9-30)
Even Forth's structural features are stack-based. For example:
```
: FLOOR5 ( n -- n' ) DUP 6 < IF DROP 5 ELSE 1 - THEN ;
```
The colon indicates the beginning of a new definition, in this case a new word (again, *word* is the term used for a subroutine) called `FLOOR5`. The text in parentheses is a comment, advising that this word expects a number on the stack and will return a possibly changed number (on the stack).
The subroutine uses the following commands: `DUP` duplicates the number on the stack; `6` pushes a 6 on top of the stack; `<` compares the top two numbers on the stack (6 and the `DUP`ed input), and replaces them with a true-or-false value; `IF` takes a true-or-false value and chooses to execute commands immediately after it or to skip to the `ELSE`; `DROP` discards the value on the stack; `5` pushes a 5 on top of the stack; and `THEN` ends the conditional.
The `FLOOR5` word is equivalent to this function written in the [C programming language](/wiki/C_(programming_language) "C (programming language)") using the [conditional operator](/wiki/Ternary_conditional_operator "Ternary conditional operator") '?:'
```
int floor5(int v) {
return (v < 6) ? 5 : (v - 1);
}
```
This function is written more succinctly as:
```
: FLOOR5 ( n -- n' ) 1- 5 MAX ;
```
This can be run as follows:
```
1 FLOOR5 CR .
5 ok
8 FLOOR5 CR .
7 ok
```
First a number (1 or 8) is pushed onto the stack, `FLOOR5` is called, which pops the number again and pushes the result. `CR` moves the output to a new line (again, this is only here for readability). Finally, a call to `.` pops the result and prints.
## Facilities
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=4 "Edit section: Facilities")]
Forth's [grammar](/wiki/Formal_grammar "Formal grammar") has no official specification. Instead, it is defined by a simple algorithm. The interpreter reads a line of input from the user input device, which is then parsed for a word using spaces as a [delimiter](/wiki/Delimiter "Delimiter"); some systems recognise additional [whitespace](/wiki/Whitespace_character "Whitespace character") characters. When the interpreter finds a word, it looks the word up in the *dictionary*. If the word is found, the interpreter executes the code associated with the word, and then returns to parse the rest of the input stream. If the word isn't found, the word is assumed to be a number and an attempt is made to convert it into a number and push it on the stack; if successful, the interpreter continues parsing the input stream. Otherwise, if both the lookup and the number conversion fail, the interpreter prints the word followed by an error message indicating that the word is not recognised, flushes the input stream, and waits for new user input.[[30]](#cite_note-6dQ7P-31)
The definition of a new word is started with the word `:` (colon) and ends with the word `;` (semi-colon). For example,
```
: X DUP 1+ . . ;
```
will compile the word `X`, and makes the name findable in the dictionary. When executed by typing `10 X` at the console this will print `11 10`.[[31]](#cite_note-compiler-32)
Most Forth systems include an [assembler](/wiki/Assembly_language#Assembler "Assembly language") to write words using the processor's facilities. Forth assemblers often use a reverse Polish syntax in which the parameters of an instruction precede the instruction. A typical reverse Polish assembler prepares the operands on the stack and the mnemonic copies the whole instruction into memory as the last step. A Forth assembler is by nature a macro assembler, so that it is easy to define an alias for registers according to their role in the Forth system: e.g. "dsp" for the register used as the data stack pointer.[[32]](#cite_note-NAFQu-33)
### Operating system, files, and multitasking
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=5 "Edit section: Operating system, files, and multitasking")]
Most Forth systems run under a host operating system such as [Microsoft Windows](/wiki/Microsoft_Windows "Microsoft Windows"), [Linux](/wiki/Linux "Linux") or a version of [Unix](/wiki/Unix "Unix") and use the host operating system's file system for source and data files; the ANSI Forth Standard describes the words used for I/O. All modern Forth systems use normal text files for source, even if they are embedded. An embedded system with a resident compiler gets its source via a serial line.
Classic Forth systems traditionally use neither [operating system](/wiki/Operating_system "Operating system") nor [file system](/wiki/File_system "File system"). Instead of storing code in files, source code is stored in disk blocks written to physical disk addresses. The word `BLOCK` is employed to translate the number of a 1K-sized block of disk space into the address of a buffer containing the data, which is managed automatically by the Forth system. Block use has become rare since the mid-1990s. In a hosted system those blocks too are allocated in a normal file in any case.
[Multitasking](/wiki/Computer_multitasking "Computer multitasking"), most commonly [cooperative](/wiki/Computer_multitasking#Cooperative_multitasking/time-sharing "Computer multitasking") [round-robin scheduling](/wiki/Round-robin_scheduling "Round-robin scheduling"), is normally available (although multitasking words and support are not covered by the ANSI Forth Standard). The word `PAUSE` is used to save the current task's execution context, to locate the next task, and restore its execution context. Each task has its own stacks, private copies of some control variables and a scratch area. Swapping tasks is simple and efficient; as a result, Forth multitaskers are available even on very simple [microcontrollers](/wiki/Microcontroller "Microcontroller"), such as the [Intel 8051](/wiki/Intel_MCS-51 "Intel MCS-51"), [Atmel AVR](/wiki/Atmel_AVR "Atmel AVR"), and [TI MSP430](/wiki/TI_MSP430 "TI MSP430").[[33]](#cite_note-nxtDb-34)
Other non-standard facilities include a mechanism for issuing [calls](/wiki/System_call "System call") to the host OS or [windowing systems](/wiki/Windowing_system "Windowing system"), and many provide extensions that employ the scheduling provided by the operating system. Typically they have a larger and different set of words from the stand-alone Forth's `PAUSE` word for task creation, suspension, destruction and modification of priority.
### Self-compilation and cross compilation
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=6 "Edit section: Self-compilation and cross compilation")]
A full-featured Forth system with all source code will compile itself, a technique commonly called meta-compilation or [self-hosting](/wiki/Self-hosting_(compilers) "Self-hosting (compilers)"), by Forth programmers (although the term doesn't exactly match [meta-compilation](/wiki/Meta-Compilation "Meta-Compilation") as it is normally defined). The usual method is to redefine the handful of words that place compiled bits into memory. The compiler's words use specially named versions of fetch and store that can be redirected to a buffer area in memory. The buffer area simulates or accesses a memory area beginning at a different address than the code buffer. Such compilers define words to access both the target computer's memory, and the host (compiling) computer's memory.[[34]](#cite_note-Swdke-35)
After the fetch and store operations are redefined for the code space, the compiler, assembler, etc. are recompiled using the new definitions of fetch and store. This effectively reuses all the code of the compiler and interpreter. Then, the Forth system's code is compiled, but this version is stored in the buffer. The buffer in memory is written to disk, and ways are provided to load it temporarily into memory for testing. When the new version appears to work, it is written over the previous version.
Numerous variations of such compilers exist for different environments. For [embedded systems](/wiki/Embedded_system "Embedded system"), the code may instead be written to another computer, a technique known as [cross compilation](/wiki/Cross-compilation "Cross-compilation"), over a serial port or even a single [TTL](/wiki/Transistor%E2%80%93transistor_logic "Transistortransistor logic") bit, while keeping the word names and other non-executing parts of the dictionary in the original compiling computer. The minimum definitions for such a Forth compiler are the words that fetch and store a byte, and the word that commands a Forth word to be executed. Often the most time-consuming part of writing a remote port is constructing the initial program to implement fetch, store and execute, but many modern microprocessors have integrated debugging features (such as the [Motorola CPU32](/wiki/Motorola_CPU32 "Motorola CPU32")) that eliminate this task.[[35]](#cite_note-E5iFy-36)
## Structure of the language
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=7 "Edit section: Structure of the language")]
The basic data structure of Forth is the "dictionary" which maps "words" to executable code or named data structures. The dictionary is laid out in memory as a tree of [linked lists](/wiki/Linked_list "Linked list") with the links proceeding from the latest (most recently) defined word to the oldest, until a [sentinel value](/wiki/Sentinel_value "Sentinel value"), usually a NULL pointer, is found. A context switch causes a list search to start at a different leaf. A linked list search continues as the branch merges into the main trunk leading eventually back to the sentinel, the root.
There can be several dictionaries. In rare cases such as meta-compilation a dictionary might be isolated and stand-alone.
The effect resembles that of nesting namespaces and can overload keywords depending on the context.
A defined word generally consists of *head* and *body* with the head consisting of the *name field* (NF) and the *link field* (LF), and body consisting of the *code field* (CF) and the *parameter field* (PF).
Head and body of a dictionary entry are treated separately because they may not be contiguous. For example, when a Forth program is recompiled for a new platform, the head may remain on the compiling computer, while the body goes to the new platform. In some environments (such as [embedded systems](/wiki/Embedded_system "Embedded system")) the heads occupy memory unnecessarily. However, some cross-compilers may put heads in the target if the target itself is expected to support an interactive Forth.[[36]](#cite_note-lx5fY-37)
The exact format of a dictionary entry is not prescribed, and implementations vary.
### Structure of the compiler
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=8 "Edit section: Structure of the compiler")]
The compiler itself is not a monolithic program. It consists of Forth words visible to the system, and usable by a programmer. This allows a programmer to change the compiler's words for special purposes. Compilation in traditional Forth systems is straightforward and does not involve building and optimizing an abstract representation of the code. (Some newer Forth compilers use more elaborate compilation methods, as common in other languages.)
The "compile time" flag in the name field is set for words with "compile time" behavior. Most simple words execute the same code whether they are typed on a command line, or embedded in code. When compiling these, the compiler simply places code or a threaded pointer to the word.[[31]](#cite_note-compiler-32)
The classic examples of compile-time words are the [control structures](/wiki/Control_structure "Control structure") such as `IF` and `WHILE`. Almost all of Forth's control structures and almost all of its compiler are implemented as compile-time words. Apart from some rarely used [control flow](/wiki/Control_flow "Control flow") words only found in a few implementations, such as the conditional return word `?EXIT` used in Ulrich Hoffmann's preForth, all of Forth's [control flow](/wiki/Control_flow "Control flow") words are executed during compilation to compile various combinations of primitive words along with their branch addresses.[[1]](#cite_note-preForth_slides-1)[[2]](#cite_note-preForth-2)
For instance, `IF` and `WHILE`, and the words that match with those, set up `BRANCH` (unconditional branch) and `?BRANCH` (pop a value off the stack, and branch if it is false). Counted loop [control flow](/wiki/Control_flow "Control flow") words work similarly but set up combinations of primitive words that work with a counter, and so on. During compilation, the data stack is used to support control structure balancing, nesting, and back-patching of branch addresses. The snippet:
```
... DUP 6 < IF DROP 5 ELSE 1 - THEN ...
```
would often be compiled to the following sequence inside a definition:
```
... DUP LIT 6 < ?BRANCH 5 DROP LIT 5 BRANCH 3 LIT 1 - ...
```
The numbers after `BRANCH` represent relative jump addresses. `LIT` is the primitive word for pushing a "literal" number onto the data stack. (Faster, shorter code would be compiled using pointers to constants instead of `LIT` and embedded data, if any of the numbers involved have been separately defined as constants. There would be similar changes if yet other words were used instead of constants, and so on.)
#### Compilation state and interpretation state
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=9 "Edit section: Compilation state and interpretation state")]
The word `:` (colon) parses a name as a parameter, creates a dictionary entry (a *colon definition*) and enters compilation state. The interpreter continues to read space-delimited words from the user input device. If a word is found, the interpreter executes the *compilation semantics* associated with the word, instead of the *interpretation semantics*. The default compilation semantics of a word are to append its interpretation semantics to the current definition.[[31]](#cite_note-compiler-32)
The word `;` (semi-colon) finishes the current definition and returns to interpretation state. It is an example of a word whose compilation semantics differ from the default. The interpretation semantics of `;` (semi-colon), most control flow words, and several other words are undefined in ANS Forth, meaning that they must only be used inside of definitions and not on the interactive command line.[[31]](#cite_note-compiler-32)
The interpreter state can be changed manually with the words `[` (left-bracket) and `]` (right-bracket) which enter interpretation state or compilation state, respectively. These words can be used with the word `LITERAL` to calculate a value during a compilation and to insert the calculated value into the current colon definition. `LITERAL` has the compilation semantics to take an object from the data stack and to append semantics to the current colon definition to place that object on the data stack.
In ANS Forth, the current state of the interpreter can be read from the [flag](/wiki/Flag_(programming) "Flag (programming)") `STATE` which contains the value true when in compilation state and false otherwise. This allows the implementation of so-called *state-smart words* with behavior that changes according to the current state of the interpreter.
#### Immediate words
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=10 "Edit section: Immediate words")]
The word `IMMEDIATE` marks the most recent colon definition as an *immediate word*, effectively replacing its compilation semantics with its interpretation semantics.[[37]](#cite_note-odMGJ-38) Immediate words are normally executed during compilation, not compiled, but this can be overridden by the programmer in either state. `;` is an example of an immediate word. In ANS Forth, the word `POSTPONE` takes a name as a parameter and appends the compilation semantics of the named word to the current definition even if the word was marked immediate. Forth-83 defined separate words `COMPILE` and `[COMPILE]` to force the compilation of non-immediate and immediate words, respectively.
Instead of reserving space for an Immediate flag in every definition, some implementations of Forth use an Immediates Dictionary which is checked first when in compile mode.
#### Unnamed words and execution tokens
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=11 "Edit section: Unnamed words and execution tokens")]
In ANS Forth, unnamed words can be defined with the word `:NONAME` which compiles the following words up to the next `;` (semi-colon) and leaves an *execution token* on the data stack. The execution token provides an opaque handle for the compiled semantics, similar to the [function pointers](/wiki/Function_pointer "Function pointer") of the [C programming language](/wiki/C_(programming_language) "C (programming language)").
Execution tokens can be stored in variables. The word `EXECUTE` takes an execution token from the data stack and performs the associated semantics. The word `COMPILE,` (compile-comma) takes an execution token from the data stack and appends the associated semantics to the current definition.
The word `'` (tick) takes the name of a word as a parameter and returns the execution token associated with that word on the data stack. In interpretation state, `' RANDOM-WORD EXECUTE` is equivalent to `RANDOM-WORD`.[[38]](#cite_note-iUYBX-39)
#### Parsing words and comments
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=12 "Edit section: Parsing words and comments")]
The words `:` (colon), `POSTPONE`, `'` (tick) are examples of *parsing words* that take their arguments from the user input device instead of the data stack. Another example is the word `(` (paren) which reads and ignores the following words up to and including the next right parenthesis and is used to place comments in a colon definition. Similarly, the word `\` (backslash) is used for comments that continue to the end of the current line. To be parsed correctly, `(` (paren) and `\` (backslash) must be separated by whitespace from the following comment text.
### Structure of code
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=13 "Edit section: Structure of code")]
In most Forth systems, the body of a code definition consists of either [machine language](/wiki/Machine_language "Machine language"), or some form of [threaded code](/wiki/Threaded_code "Threaded code"). The original Forth which follows the informal FIG standard (Forth Interest Group), is a TIL (Threaded Interpretive Language). This is also called indirect-threaded code, but direct-threaded and subroutine threaded Forths have also become popular in modern times. The fastest modern Forths, such as SwiftForth, VFX Forth, and iForth, compile Forth to native machine code.
### Data objects
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=14 "Edit section: Data objects")]
When a word is a variable or other data object, the CF points to the runtime code associated with the defining word that created it. A defining word has a characteristic "defining behavior" (creating a dictionary entry plus possibly allocating and initializing data space) and also specifies the behavior of an instance of the class of words constructed by this defining word. Examples include:
`VARIABLE`
: Names an uninitialized, one-cell memory location. Instance behavior of a `VARIABLE` returns its address on the stack.
`CONSTANT`
: Names a value (specified as an argument to `CONSTANT`). Instance behavior returns the value.
`CREATE`
: Names a location; space may be allocated at this location, or it can be set to contain a string or other initialized value. Instance behavior returns the address of the beginning of this space.
Forth also provides a facility by which a programmer can define new application-specific defining words, specifying both a custom defining behavior and instance behavior. Some examples include circular buffers, named bits on an I/O port, and automatically indexed arrays.
Data objects defined by these and similar words are global in scope. The function provided by local variables in other languages is provided by the data stack in Forth (although Forth also has real local variables). Forth programming style uses very few named data objects compared with other languages; typically such data objects are used to contain data which is used by a number of words or tasks (in a multitasked implementation).[[39]](#cite_note-ceEJ3-40)
Forth does not enforce consistency of [data type](/wiki/Data_type "Data type") usage; it is the programmer's responsibility to use appropriate operators to fetch and store values or perform other operations on data.
## Examples
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=15 "Edit section: Examples")]
### “Hello, World!”
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=16 "Edit section: “Hello, World!”")]
```
: HELLO ( -- ) CR ." Hello, World!" ;
```
```
HELLO <cr>
Hello, World!
```
The word `CR` (Carriage Return) causes the output following `CR`
to be displayed on a new line. The parsing word `."` (dot-quote) reads a double-quote delimited string and appends code to the current definition so that the parsed string will be displayed upon execution. The space character separating the word `."` from the string `Hello, World!` is not included as part of the string. It is needed so that the parser recognizes `."` as a Forth word.
A standard Forth system is also an interpreter, and the same output can be obtained by typing the following code fragment into the Forth console:
```
CR .( Hello, World!)
```
`.(` (dot-paren) is an immediate word that parses a parenthesis-delimited string and displays it. As with the word `."` the space character separating `.(` from `Hello, World!` is not part of the string.
The word `CR` comes before the text to print. By convention, the Forth interpreter does not start output on a new line. Also by convention, the interpreter waits for input at the end of the previous line, after an `ok` prompt. There is no implied "flush-buffer" action in Forth's `CR`, as sometimes is in other programming languages.
### Mixing states of compiling and interpreting
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=17 "Edit section: Mixing states of compiling and interpreting")]
Here is the definition of a word `EMIT-Q` which when executed emits the single character `Q`:
```
: EMIT-Q 81 ( the ASCII value for the character 'Q' ) EMIT ;
```
This definition was written to use the [ASCII](/wiki/ASCII "ASCII") value of the `Q` character (81) directly. The text between the parentheses is a comment and is ignored by the compiler. The word `EMIT` takes a value from the data stack and displays the corresponding character.
The following redefinition of `EMIT-Q` uses the words `[` (left-bracket), `]` (right-bracket), `CHAR` and `LITERAL` to temporarily switch to interpreter state, calculate the ASCII value of the `Q` character, return to compilation state and append the calculated value to the current colon definition:
```
: EMIT-Q [ CHAR Q ] LITERAL EMIT ;
```
The parsing word `CHAR` takes a space-delimited word as parameter and places the value of its first character on the data stack. The word `[CHAR]` is an immediate version of `CHAR`. Using `[CHAR]`, the example definition for `EMIT-Q` could be rewritten like this:
```
: EMIT-Q [CHAR] Q EMIT ; \ Emit the single character 'Q'
```
This definition used `\` (backslash) for the describing comment.
Both `CHAR` and `[CHAR]` are predefined in ANS Forth. Using `IMMEDIATE` and `POSTPONE`, `[CHAR]` could have been defined like this:
```
: [CHAR] CHAR POSTPONE LITERAL ; IMMEDIATE
```
### RC4 cipher program
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=18 "Edit section: RC4 cipher program")]
In 1987, [Ron Rivest](/wiki/Ron_Rivest "Ron Rivest") developed the [RC4](/wiki/RC4 "RC4") cipher-system for RSA Data Security, Inc. Its description follows:
> We have an array of 256 bytes, all different. Every time the array is used it changes by swapping two bytes. The swaps are controlled by counters *i* and *j*, each initially 0. To get a new *i*, add 1. To get a new *j*, add the array byte at the new *i*. Exchange the array bytes at *i* and *j*. The code is the array byte at the sum of the array bytes at *i* and *j*. This is XORed with a byte of the plaintext to encrypt, or the ciphertext to decrypt. The array is initialized by first setting it to 0 through 255. Then step through it using *i* and *j*, getting the new *j* by adding to it the array byte at *i* and a key byte, and swapping the array bytes at *i* and *j*. Finally, *i* and *j* are set to 0. All additions are modulo 256.
The following Standard Forth version uses Core and Core Extension words only.
```
0 value ii 0 value jj
0 value KeyAddr 0 value KeyLen
create SArray 256 allot \ state array of 256 bytes
: KeyArray KeyLen mod KeyAddr ;
: get_byte + c@ ;
: set_byte + c! ;
: as_byte 255 and ;
: reset_ij 0 TO ii 0 TO jj ;
: i_update 1 + as_byte TO ii ;
: j_update ii SArray get_byte + as_byte TO jj ;
: swap_s_ij
jj SArray get_byte
ii SArray get_byte jj SArray set_byte
ii SArray set_byte
;
: rc4_init ( KeyAddr KeyLen -- )
256 min TO KeyLen TO KeyAddr
256 0 DO i i SArray set_byte LOOP
reset_ij
BEGIN
ii KeyArray get_byte jj + j_update
swap_s_ij
ii 255 < WHILE
ii i_update
REPEAT
reset_ij
;
: rc4_byte
ii i_update jj j_update
swap_s_ij
ii SArray get_byte jj SArray get_byte + as_byte SArray get_byte xor
;
```
This is one way to test the code:
```
hex
create AKey 61 c, 8A c, 63 c, D2 c, FB c,
: test cr 0 DO rc4_byte . LOOP cr ;
AKey 5 rc4_init
2C F9 4C EE DC 5 test \ output should be: F1 38 29 C9 DE
```
## Forth engines
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=19 "Edit section: Forth engines")]
A processor designed to support a specific programming language is called a language "engine".[[40]](#cite_note-dumse-41)
Forth engines are hardware platforms specifically designed to support developing and running programs written in Forth. (Likewise, [Lisp machines](/wiki/Lisp_machine "Lisp machine") were specifically designed to support developing and running programs written in Lisp, the [Pascal MicroEngine](/wiki/Pascal_MicroEngine "Pascal MicroEngine") was specifically designed to support developing and running programs written in Pascal, etc.).
The first commercially available single-chip Forth engine was the Rockwell R65F11,[[40]](#cite_note-dumse-41)
a chip that includes a Forth kernel in ROM,
an [enhanced 6502](/wiki/MOS_Technology_6502#Variations_and_derivatives "MOS Technology 6502"), SRAM, and various interface circuits that previously required peripheral chips.[[40]](#cite_note-dumse-41)[[41]](#cite_note-42)[[42]](#cite_note-43)[[43]](#cite_note-44)[[44]](#cite_note-45)
Many other commercial CPUs (Harris RTX-2000, Novix NC4016, F21, MARC4, KimKlone, etc.) and many [homebrew CPUs](/wiki/Homebrew_CPU "Homebrew CPU") (My4TH, J1, H2, Mark 1 FORTH Computer, etc.) are specifically designed to run Forth. Typically they implement common Forth primitives such as the "Forth NEXT" as single instructions.
## Implementations
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=20 "Edit section: Implementations")]
Because Forth is simple to implement and has no standard reference implementation, there are numerous versions of the language. In addition to supporting the standard varieties of desktop computer systems ([POSIX](/wiki/POSIX "POSIX"), [Microsoft Windows](/wiki/Microsoft_Windows "Microsoft Windows"), [macOS](/wiki/MacOS "MacOS")), many of these Forth systems also target a variety of [embedded systems](/wiki/Embedded_system "Embedded system"). Listed here are some of the systems which conform to the 1994 ANS Forth standard.
* ASYST, a Forth-like system for data collection and analysis [[45]](#cite_note-46)[[16]](#cite_note-Rwirj-17)
* [Gforth](/wiki/Gforth "Gforth"), a portable ANS Forth implementation from the [GNU Project](/wiki/GNU_Project "GNU Project")
* [noForth](https://home.hccnet.nl/anij/nof/noforth.html), an ANS Forth implementation (as far as possible) for Flash microcontrollers (MSP430, RISC-V & RP2040)
* [Open Firmware](/wiki/Open_Firmware "Open Firmware"), a [bootloader](/wiki/Bootloader "Bootloader") and [firmware](/wiki/Firmware "Firmware") standard based on ANS Forth
* [pForth](/wiki/PForth "PForth"), portable Forth written in C
* SP-Forth, ANS Forth implementation from the Russian Forth Interest Group (RuFIG)
* Swift Forth, machine code generating implementation from Forth, Inc.
* VFX Forth, optimizing native code Forth
* [Firth](https://littlemanstackmachine.org/firth.html), an adaptation of Forth for the Little Man Stack Machine computer.
* [Shi](https://gitlab.com/higaski/Shi), a fast and tiny embeddable Forth implementation written for the Thumb-2 ISA (ARMv7-M and newer).
## See also
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=21 "Edit section: See also")]
* [Video games written in Forth](/wiki/Category:Video_games_written_in_Forth "Category:Video games written in Forth")
* [RTX2010](/wiki/RTX2010 "RTX2010"), a CPU that runs Forth natively
## Notes
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=22 "Edit section: Notes")]
1. **[^](#cite_ref-3)**
There are exceptions, such as Ulrich Hoffmann's preForth[[1]](#cite_note-preForth_slides-1)[[2]](#cite_note-preForth-2) and Tom Zimmer's TCOM
## References
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=23 "Edit section: References")]
1. ^ [***a***](#cite_ref-preForth_slides_1-0) [***b***](#cite_ref-preForth_slides_1-1)
["Ulrich Hoffmann's preForth slides"](http://www.euroforth.org/ef18/papers/hoffmann-slides.pdf) (PDF).
2. ^ [***a***](#cite_ref-preForth_2-0) [***b***](#cite_ref-preForth_2-1)
["Ulrich Hoffmann's preForth"](http://www.euroforth.org/ef18/papers/hoffmann.pdf) (PDF).
3. ^ [***a***](#cite_ref-maher_4-0) [***b***](#cite_ref-maher_4-1) Maher, Jimmy (October 28, 2014). ["Starflight"](https://www.filfre.net/2014/10/starflight/). *The Digital Antiquarian*. Retrieved April 29, 2023.
4. **[^](#cite_ref-oSWRm_5-0)** [NASA applications of Forth](https://web.archive.org/web/20101024223709/http://forth.gsfc.nasa.gov/) (original NASA server no longer running, copy from archive.org)
5. **[^](#cite_ref-zYmBe_6-0)** ["Intersil's RTX processors and Forth software controlled the successful Philae landing"](https://web.archive.org/web/20230429195754/https://mpeforth.com/press/MPE_PR_From_Telescope_to_Comet_2014_11_13.pdf) (PDF). *MicroProcessor Engineering Limited*. October 13, 2014. Archived from [the original](https://mpeforth.com/press/MPE_PR_From_Telescope_to_Comet_2014_11_13.pdf) (PDF) on April 29, 2023. Retrieved April 29, 2023.
6. **[^](#cite_ref-sgEMh_7-0)** ["Here comes Philae! Powered by an RTX2010"](https://www.cpushack.com/2014/11/12/here-comes-philae-powered-by-an-rtx2010/). *The CPU Shack Museum*. October 12, 2014. Retrieved April 29, 2023.
7. **[^](#cite_ref-C4Oss_8-0)** ["Space Related Applications of Forth"](https://web.archive.org/web/20101024223709/http://forth.gsfc.nasa.gov/). Archived from [the original](https://forth.gsfc.nasa.gov) on 2010-10-24. Retrieved 2007-09-04.
8. ^ [***a***](#cite_ref-evolution_9-0) [***b***](#cite_ref-evolution_9-1) [***c***](#cite_ref-evolution_9-2) Rather, Elizabeth D.; Colburn, Donald R.; Moore, Charles H. (1996) [1993]. ["The evolution of Forth"](http://www.forth.com/resources/evolution/index.html). In Bergin, Thomas J.; Gibson, Richard G. (eds.). *History of programming languages---II*. Association for Computing Machinery. pp. 625670. [doi](/wiki/Doi_(identifier) "Doi (identifier)"):[10.1145/234286.1057832](https://doi.org/10.1145%2F234286.1057832). [ISBN](/wiki/ISBN_(identifier) "ISBN (identifier)") [0201895021](/wiki/Special:BookSources/0201895021 "Special:BookSources/0201895021").
9. **[^](#cite_ref-10)** ["Atari In-Store Demonstration Program"](http://www.atarimania.com/demo-atari-400-800-xl-xe-in-store-demonstration-program_19329.html). *Atari Mania*.
10. **[^](#cite_ref-11)** Maynard, David S. ["David Maynard: Software Artist"](https://www.software-artist.com).
11. **[^](#cite_ref-12)** John Romero (2020-09-23). ["Time Warp: Episode 9 - Stuart Smith"](https://appletimewarp.libsyn.com/episode-9-stuart-smith) (Podcast). Event occurs at 29:02.
12. **[^](#cite_ref-13)** Aycock, John (2023). [*Amnesia Remembered: Reverse Engineering a Digital Artifact*](https://www.berghahnbooks.com/title/AycockAmnesia). Berghahn Books. p. 79. [ISBN](/wiki/ISBN_(identifier) "ISBN (identifier)") [978-1800738676](/wiki/Special:BookSources/978-1800738676 "Special:BookSources/978-1800738676").
13. **[^](#cite_ref-14)** Sharp, Doug (8 April 2023). ["FORTH Programming Language (Going FORTH)"](https://chipwits.com/2023/04/08/forth-programming-language-going-forth/).
14. **[^](#cite_ref-15)** Rochat, Jan (February 6, 2025). ["Back to 1985: How We Remade ChipWits for the C64"](https://chipwits.com/2025/02/06/back-to-1985-how-we-remade-chipwits-for-the-c64/).
15. **[^](#cite_ref-16)** ["FORTH GETS ITS OWN SPECIAL INTEREST GROUP"](https://techmonitor.ai/technology/forth_gets_its_own_special_interest_group). *Tech Monitor*. 6 February 1989.
16. ^ [***a***](#cite_ref-Rwirj_17-0) [***b***](#cite_ref-Rwirj_17-1) Campbell et al, "Up and Running with Asyst 2.0", MacMillan Software Co., 1987
17. **[^](#cite_ref-WYK4Z_18-0)** Moore, Charles H. (1991). ["Forth - The Early Years"](https://web.archive.org/web/20060615025259/http://www.colorforth.com/HOPL.html). Archived from [the original](http://www.colorforth.com/HOPL.html) on 2006-06-15. Retrieved 2006-06-03.
18. **[^](#cite_ref-19)** Moore, Charles H. (August 1980). ["The Evolution of FORTH, an Unusual Language"](https://archive.org/details/byte-magazine-1980-08/page/n77/mode/2up). *BYTE Magazine*. **5** (8): 82.
19. **[^](#cite_ref-20)** ["ANS 1994 Specification, Annex C ("Perspective")"](https://www.taygeta.com/forth/dpansc.htm). *taygeta.com*.
20. **[^](#cite_ref-1AvuY_21-0)** ["The Forth Language"](https://archive.org/details/byte-magazine-1980-08/), *BYTE Magazine*, **5** (8), 1980
21. **[^](#cite_ref-family-tree_22-0)** M. Anton Ertl. ["Forth family tree and timeline"](https://www.complang.tuwien.ac.at/forth/family-tree/).
22. **[^](#cite_ref-gWyzb_23-0)** Lutus, Paul (1982). ["GraFORTH Language Manual"](https://archive.org/details/graforth1). *archive.org*. Insoft.
23. **[^](#cite_ref-qyrcN_24-0)** ["The Forth-79 Standard"](https://www.physics.wisc.edu/~lmaurer/forth/Forth-79.pdf) (PDF). Retrieved 2023-04-29.
24. **[^](#cite_ref-BQ2oi_25-0)** ["The Forth-83 Standard"](https://web.archive.org/web/20230405001333/https://forth.sourceforge.net/standard/fst83/). Archived from [the original](https://forth.sourceforge.net/standard/fst83/) on 2023-04-05. Retrieved 2023-04-29.
25. **[^](#cite_ref-IGDIN_26-0)** ["Programming Languages: Forth"](https://www.taygeta.com/forth/dpans.html). ANSI technical committee X3J14. 24 March 1994. Retrieved 2006-06-03.
26. **[^](#cite_ref-KojQK_27-0)** ["Standard Forth (ANSI INCITS 215-1994) Reference"](http://quartus.net/files/PalmOS/Forth/Docs/stdref.pdf) (PDF). Quartus Handheld Software. 13 September 2005. Retrieved 2023-04-29.
27. **[^](#cite_ref-BtuRy_28-0)** Claunch, Carl (2018-03-02). ["Restoring the original source code for FORTH on the IBM 1130"](https://rescue1130.blogspot.com/2018/03/restoring-original-source-code-for.html). *rescue1130*. Retrieved July 30, 2018.
28. **[^](#cite_ref-29)**
Brodie, Leo (1987). [*Starting Forth*](https://www.forth.com/starting-forth/index.html) (2nd ed.). Prentice-Hall. [ISBN](/wiki/ISBN_(identifier) "ISBN (identifier)") [978-0-13-843079-5](/wiki/Special:BookSources/978-0-13-843079-5 "Special:BookSources/978-0-13-843079-5").
29. **[^](#cite_ref-3yqc9_30-0)** [Brodie 1987](#CITEREFBrodie1987), p. 20
30. **[^](#cite_ref-6dQ7P_31-0)**
[Brodie 1987](#CITEREFBrodie1987), p. 14
31. ^ [***a***](#cite_ref-compiler_32-0) [***b***](#cite_ref-compiler_32-1) [***c***](#cite_ref-compiler_32-2) [***d***](#cite_ref-compiler_32-3)
[Brodie 1987](#CITEREFBrodie1987), p. 16
32. **[^](#cite_ref-NAFQu_33-0)** Rodriguez, Brad. ["Build Your Own Assembler, Part 2: a 6809 Forth Assembler"](https://www.bradrodriguez.com/papers/6809asm.txt). Retrieved 2023-04-29.
33. **[^](#cite_ref-nxtDb_34-0)** Rodriguez, Brad. ["Multitasking 8051 CamelForth"](https://www.bradrodriguez.com/papers/8051task.pdf) (PDF). Retrieved 2023-04-29.
34. **[^](#cite_ref-Swdke_35-0)** Rodriguez, Brad (JulyAugust 1995). ["MOVING FORTH, Part 8: CamelForth for the 6809"](https://www.bradrodriguez.com/papers/moving8.htm). Retrieved 2023-04-29.
35. **[^](#cite_ref-E5iFy_36-0)** Shoebridge, Peter (1998-12-21). ["Motorola Background Debugging Mode Driver for Windows NT"](https://web.archive.org/web/20070606083244/http://www.zeecube.com/archive/bdm/index.htm). Archived from [the original](http://www.zeecube.com/archive/bdm/index.htm) on 2007-06-06. Retrieved 2006-06-19.
36. **[^](#cite_ref-lx5fY_37-0)** Martin, Harold M. (March 1991). ["Developing a tethered Forth model"](https://doi.org/10.1145%2F122089.122091). *ACM SIGFORTH Newsletter*. **2** (3). ACM Press: 1719. [doi](/wiki/Doi_(identifier) "Doi (identifier)"):[10.1145/122089.122091](https://doi.org/10.1145%2F122089.122091). [S2CID](/wiki/S2CID_(identifier) "S2CID (identifier)") [26362015](https://api.semanticscholar.org/CorpusID:26362015).
37. **[^](#cite_ref-odMGJ_38-0)** [Brodie 1987](#CITEREFBrodie1987), p. 273
38. **[^](#cite_ref-iUYBX_39-0)** [Brodie 1987](#CITEREFBrodie1987), p. 199
39. **[^](#cite_ref-ceEJ3_40-0)** "Under The Hood". *[Brodie 1987](#CITEREFBrodie1987)*. p. 241. "To summarize, there are three kinds of variables: System variables contain values used by the entire Forth system. User variables contain values that are unique for each task, even though the definitions can be used by all tasks in the system. Regular variables can be accessible either system-wide or within a single task only, depending upon whether they are defined within `OPERATOR` or within a private task."
40. ^ [***a***](#cite_ref-dumse_41-0) [***b***](#cite_ref-dumse_41-1) [***c***](#cite_ref-dumse_41-2) Randy M. Dumse.
"The R65F11 and F68K Single-Chip Forth Computers".
[[1]](http://www.forth.org/bournemouth/jfar/vol2/no1/article1.pdf)[*[permanent dead link](/wiki/Wikipedia:Link_rot "Wikipedia:Link rot")*]
[[2]](http://soton.mpeforth.com/flag/jfar/vol2/no1/article1.pdf) [Archived](https://web.archive.org/web/20141202144044/http://soton.mpeforth.com/flag/jfar/vol2/no1/article1.pdf) 2014-12-02 at the [Wayback Machine](/wiki/Wayback_Machine "Wayback Machine")
1984.
41. **[^](#cite_ref-42)**
Ed Schmauch.
["A Computerized Corrosion Monitoring System"](http://www.forth.org/bournemouth/jfar/vol4/no2/article48.pdf)[*[permanent dead link](/wiki/Wikipedia:Link_rot "Wikipedia:Link rot")*].
1986.
42. **[^](#cite_ref-43)** Lawrence P. Forsley.
["Embedded systems: 1990 Rochester Forth Conference: June 12 16th, 1990 University of Rochester"](https://books.google.com/books?id=Yx8YAQAAMAAJ) [Archived](https://web.archive.org/web/20150325214054/http://books.google.com/books?id=Yx8YAQAAMAAJ) 2015-03-25 at the [Wayback Machine](/wiki/Wayback_Machine "Wayback Machine").
p. 51.
43. **[^](#cite_ref-44)** Rockwell.
["RSC-Forth User's Manual"](http://www.smallestplcoftheworld.org/RSC-FORTH_User's_Manual.pdf) [Archived](https://web.archive.org/web/20131207015149/http://smallestplcoftheworld.org/RSC-FORTH_User%27s_Manual.pdf) 2013-12-07 at the [Wayback Machine](/wiki/Wayback_Machine "Wayback Machine").
1983.
44. **[^](#cite_ref-45)** ["Rockwell R65F11 R65F12 Forth Based Microcomputers"](http://archive.6502.org/datasheets/rockwell_r65f11_r65f12_forth_microcomputers.pdf) (PDF). June 1987. [Archived](https://web.archive.org/web/20200804035007/http://archive.6502.org/datasheets/rockwell_r65f11_r65f12_forth_microcomputers.pdf) (PDF) from the original on 4 August 2020. Retrieved 28 Apr 2020.
45. **[^](#cite_ref-46)** Hary, David; Oshio, Koichi; Flanagan, Steven D. (1987). "The ASYST Software for Scientific Computing". *Science*. **236** (4805): 112832. [Bibcode](/wiki/Bibcode_(identifier) "Bibcode (identifier)"):[1987Sci...236.1128H](https://ui.adsabs.harvard.edu/abs/1987Sci...236.1128H). [doi](/wiki/Doi_(identifier) "Doi (identifier)"):[10.1126/science.236.4805.1128](https://doi.org/10.1126%2Fscience.236.4805.1128). [JSTOR](/wiki/JSTOR_(identifier) "JSTOR (identifier)") [1699106](https://www.jstor.org/stable/1699106). [PMID](/wiki/PMID_(identifier) "PMID (identifier)") [17799670](https://pubmed.ncbi.nlm.nih.gov/17799670). [S2CID](/wiki/S2CID_(identifier) "S2CID (identifier)") [30463062](https://api.semanticscholar.org/CorpusID:30463062).
## External links
[[edit](/w/index.php?title=Forth_(programming_language)&action=edit&section=24 "Edit section: External links")]
* [Forth 2012 Standard](https://forth-standard.org) official site
* [*Programming a problem-oriented language*](https://forth.org/POL.pdf) unpublished book by Charles H. Moore (1970)
* [Annual European Forth Conference](https://www.euroforth.org/) 1985present
* [Forth Research](https://www.complang.tuwien.ac.at/projects/forth.html) at Institut für Computersprachen
[![](//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/40px-Commons-logo.svg.png)](/wiki/File:Commons-logo.svg)
Wikimedia Commons has media related to [Forth (programming language)](https://commons.wikimedia.org/wiki/Category:Forth_(programming_language) "commons:Category:Forth (programming language)").
[![](//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png)](/wiki/File:Wikibooks-logo-en-noslogan.svg)
Wikibooks has a book on the topic of: ***[Forth](https://en.wikibooks.org/wiki/Forth "wikibooks:Forth")***
| * [v](/wiki/Template:Programming_languages "Template:Programming languages") * [t](/wiki/Template_talk:Programming_languages "Template talk:Programming languages") * [e](/wiki/Special:EditPage/Template:Programming_languages "Special:EditPage/Template:Programming languages") [Programming languages](/wiki/Programming_language "Programming language") | |
| --- | --- |
| * [Comparison](/wiki/Comparison_of_programming_languages "Comparison of programming languages") * [Timeline](/wiki/Timeline_of_programming_languages "Timeline of programming languages") * [History](/wiki/History_of_programming_languages "History of programming languages") | |
| * [Ada](/wiki/Ada_(programming_language) "Ada (programming language)") * [ALGOL](/wiki/ALGOL "ALGOL") + [Simula](/wiki/Simula "Simula") * [APL](/wiki/APL_(programming_language) "APL (programming language)") * [Assembly](/wiki/Assembly_language "Assembly language") * [BASIC](/wiki/BASIC "BASIC") + [Visual Basic](/wiki/Visual_Basic "Visual Basic") - [classic](/wiki/Visual_Basic_(classic) "Visual Basic (classic)") - [.NET](/wiki/Visual_Basic_(.NET) "Visual Basic (.NET)") * [C](/wiki/C_(programming_language) "C (programming language)") * [C++](/wiki/C%2B%2B "C++") * [C#](/wiki/C_Sharp_(programming_language) "C Sharp (programming language)") * [COBOL](/wiki/COBOL "COBOL") * [Erlang](/wiki/Erlang_(programming_language) "Erlang (programming language)") + [Elixir](/wiki/Elixir_(programming_language) "Elixir (programming language)") * Forth * [Fortran](/wiki/Fortran "Fortran") * [Go](/wiki/Go_(programming_language) "Go (programming language)") * [Haskell](/wiki/Haskell "Haskell") * [Java](/wiki/Java_(programming_language) "Java (programming language)") * [JavaScript](/wiki/JavaScript "JavaScript") * [Julia](/wiki/Julia_(programming_language) "Julia (programming language)") * [Kotlin](/wiki/Kotlin "Kotlin") * [Lisp](/wiki/Lisp_(programming_language) "Lisp (programming language)") * [Lua](/wiki/Lua "Lua") * [MATLAB](/wiki/MATLAB "MATLAB") * [ML](/wiki/ML_(programming_language) "ML (programming language)") + [Caml](/wiki/Caml "Caml") - [OCaml](/wiki/OCaml "OCaml") + [Standard ML](/wiki/Standard_ML "Standard ML") * [Pascal](/wiki/Pascal_(programming_language) "Pascal (programming language)") + [Object Pascal](/wiki/Object_Pascal "Object Pascal") * [Perl](/wiki/Perl "Perl") + [Raku](/wiki/Raku_(programming_language) "Raku (programming language)") * [PHP](/wiki/PHP "PHP") * [Prolog](/wiki/Prolog "Prolog") * [Python](/wiki/Python_(programming_language) "Python (programming language)") * [R](/wiki/R_(programming_language) "R (programming language)") * [Ruby](/wiki/Ruby_(programming_language) "Ruby (programming language)") * [Rust](/wiki/Rust_(programming_language) "Rust (programming language)") * [SAS](/wiki/SAS_language "SAS language") * [SQL](/wiki/SQL "SQL") * [Scratch](/wiki/Scratch_(programming_language) "Scratch (programming language)") * [Shell](/wiki/Shell_script "Shell script") * [Smalltalk](/wiki/Smalltalk "Smalltalk") * [Swift](/wiki/Swift_(programming_language) "Swift (programming language)") * *[more...](/wiki/List_of_programming_languages "List of programming languages")* | |
| * **Lists:** [Alphabetical](/wiki/List_of_programming_languages "List of programming languages") * [Categorical](/wiki/List_of_programming_languages_by_type "List of programming languages by type") * [Generational](/wiki/Generational_list_of_programming_languages "Generational list of programming languages") * [Non-English-based](/wiki/Non-English-based_programming_languages "Non-English-based programming languages") * [Category](/wiki/Category:Programming_languages "Category:Programming languages") | |
| [Authority control databases](/wiki/Help:Authority_control "Help:Authority control") [Edit this at Wikidata](https://www.wikidata.org/wiki/Q275472#identifiers "Edit this at Wikidata") | |
| --- | --- |
| International | * [GND](https://d-nb.info/gnd/4017981-3) |
| National | * [United States](https://id.loc.gov/authorities/sh85050918) * [Israel](https://www.nli.org.il/en/authorities/987007545715805171) |
| Other | * [Yale LUX](https://lux.collections.yale.edu/view/concept/931111ef-f1ef-4ba1-8d0d-0108e93a3b91) |
![](https://en.wikipedia.org/wiki/Special:CentralAutoLogin/start?useformat=desktop&type=1x1&usesul3=1)
Retrieved from "<https://en.wikipedia.org/w/index.php?title=Forth_(programming_language)&oldid=1330667744>"
[Categories](/wiki/Help:Category "Help:Category"):
* [Forth programming language family](/wiki/Category:Forth_programming_language_family "Category:Forth programming language family")
* [Concatenative programming languages](/wiki/Category:Concatenative_programming_languages "Category:Concatenative programming languages")
* [Stack-based virtual machines](/wiki/Category:Stack-based_virtual_machines "Category:Stack-based virtual machines")
* [Systems programming languages](/wiki/Category:Systems_programming_languages "Category:Systems programming languages")
* [Programming languages created in 1970](/wiki/Category:Programming_languages_created_in_1970 "Category:Programming languages created in 1970")
* [Extensible syntax programming languages](/wiki/Category:Extensible_syntax_programming_languages "Category:Extensible syntax programming languages")
* [Programming languages with an ISO standard](/wiki/Category:Programming_languages_with_an_ISO_standard "Category:Programming languages with an ISO standard")
* [Programming languages](/wiki/Category:Programming_languages "Category:Programming languages")
* [1970 software](/wiki/Category:1970_software "Category:1970 software")
Hidden categories:
* [All articles with dead external links](/wiki/Category:All_articles_with_dead_external_links "Category:All articles with dead external links")
* [Articles with dead external links from May 2017](/wiki/Category:Articles_with_dead_external_links_from_May_2017 "Category:Articles with dead external links from May 2017")
* [Articles with permanently dead external links](/wiki/Category:Articles_with_permanently_dead_external_links "Category:Articles with permanently dead external links")
* [Webarchive template wayback links](/wiki/Category:Webarchive_template_wayback_links "Category:Webarchive template wayback links")
* [Articles with short description](/wiki/Category:Articles_with_short_description "Category:Articles with short description")
* [Short description is different from Wikidata](/wiki/Category:Short_description_is_different_from_Wikidata "Category:Short description is different from Wikidata")
* [All articles with unsourced statements](/wiki/Category:All_articles_with_unsourced_statements "Category:All articles with unsourced statements")
* [Articles with unsourced statements from April 2022](/wiki/Category:Articles_with_unsourced_statements_from_April_2022 "Category:Articles with unsourced statements from April 2022")
* [Commons category link is on Wikidata](/wiki/Category:Commons_category_link_is_on_Wikidata "Category:Commons category link is on Wikidata")
* [Articles with example C code](/wiki/Category:Articles_with_example_C_code "Category:Articles with example C code")
* This page was last edited on 1 January 2026, at 20:21 (UTC).
* Text is available under the [Creative Commons Attribution-ShareAlike 4.0 License](/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License "Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License");
additional terms may apply. By using this site, you agree to the [Terms of Use](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use "foundation:Special:MyLanguage/Policy:Terms of Use") and [Privacy Policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy "foundation:Special:MyLanguage/Policy:Privacy policy"). Wikipedia® is a registered trademark of the [Wikimedia Foundation, Inc.](https://wikimediafoundation.org/), a non-profit organization.
* [Privacy policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy)
* [About Wikipedia](/wiki/Wikipedia:About)
* [Disclaimers](/wiki/Wikipedia:General_disclaimer)
* [Contact Wikipedia](//en.wikipedia.org/wiki/Wikipedia:Contact_us)
* [Legal & safety contacts](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Legal:Wikimedia_Foundation_Legal_and_Safety_Contact_Information)
* [Code of Conduct](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct)
* [Developers](https://developer.wikimedia.org)
* [Statistics](https://stats.wikimedia.org/#/en.wikipedia.org)
* [Cookie statement](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement)
* [Mobile view](//en.wikipedia.org/w/index.php?title=Forth_(programming_language)&mobileaction=toggle_view_mobile)
* [![Wikimedia Foundation](/static/images/footer/wikimedia.svg)](https://www.wikimedia.org/)
* [![Powered by MediaWiki](/w/resources/assets/mediawiki_compact.svg)](https://www.mediawiki.org/)
Search
Search
Toggle the table of contents
Forth (programming language)
34 languages
[Add topic](#)

View File

@@ -0,0 +1,445 @@
# b4 virtual machine
**Source:** https://github.com/tangentstorm/b4
GitHub - tangentstorm/b4: b4 : a tiny forth-like virtual machine
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Ftangentstorm%2Fb4)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Ftangentstorm%2Fb4)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=tangentstorm%2Fb4)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[tangentstorm](/tangentstorm)
/
**[b4](/tangentstorm/b4)**
Public
* [Notifications](/login?return_to=%2Ftangentstorm%2Fb4) You must be signed in to change notification settings
* [Fork
4](/login?return_to=%2Ftangentstorm%2Fb4)
* [Star
39](/login?return_to=%2Ftangentstorm%2Fb4)
b4 : a tiny forth-like virtual machine
[www.reddit.com/r/b4lang/](http://www.reddit.com/r/b4lang/ "http://www.reddit.com/r/b4lang/")
[39
stars](/tangentstorm/b4/stargazers) [4
forks](/tangentstorm/b4/forks) [Branches](/tangentstorm/b4/branches) [Tags](/tangentstorm/b4/tags) [Activity](/tangentstorm/b4/activity)
[Star](/login?return_to=%2Ftangentstorm%2Fb4)
[Notifications](/login?return_to=%2Ftangentstorm%2Fb4) You must be signed in to change notification settings
* [Code](/tangentstorm/b4)
* [Issues
0](/tangentstorm/b4/issues)
* [Pull requests
2](/tangentstorm/b4/pulls)
* [Actions](/tangentstorm/b4/actions)
* [Projects
0](/tangentstorm/b4/projects)
* [Wiki](/tangentstorm/b4/wiki)
* [Security
0](/tangentstorm/b4/security)
* [Insights](/tangentstorm/b4/pulse)
Additional navigation options
* [Code](/tangentstorm/b4)
* [Issues](/tangentstorm/b4/issues)
* [Pull requests](/tangentstorm/b4/pulls)
* [Actions](/tangentstorm/b4/actions)
* [Projects](/tangentstorm/b4/projects)
* [Wiki](/tangentstorm/b4/wiki)
* [Security](/tangentstorm/b4/security)
* [Insights](/tangentstorm/b4/pulse)
# tangentstorm/b4
main
[Branches](/tangentstorm/b4/branches)[Tags](/tangentstorm/b4/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[1,568 Commits](/tangentstorm/b4/commits/main/) 1,568 Commits | | |
| [b3a](/tangentstorm/b4/tree/main/b3a "b3a") | | [b3a](/tangentstorm/b4/tree/main/b3a "b3a") | | |
| [bios](/tangentstorm/b4/tree/main/bios "bios") | | [bios](/tangentstorm/b4/tree/main/bios "bios") | | |
| [doc](/tangentstorm/b4/tree/main/doc "doc") | | [doc](/tangentstorm/b4/tree/main/doc "doc") | | |
| [electron](/tangentstorm/b4/tree/main/electron "electron") | | [electron](/tangentstorm/b4/tree/main/electron "electron") | | |
| [etc](/tangentstorm/b4/tree/main/etc "etc") | | [etc](/tangentstorm/b4/tree/main/etc "etc") | | |
| [jlang](/tangentstorm/b4/tree/main/jlang "jlang") | | [jlang](/tangentstorm/b4/tree/main/jlang "jlang") | | |
| [js](/tangentstorm/b4/tree/main/js "js") | | [js](/tangentstorm/b4/tree/main/js "js") | | |
| [lil](/tangentstorm/b4/tree/main/lil "lil") | | [lil](/tangentstorm/b4/tree/main/lil "lil") | | |
| [mcp-b4i](/tangentstorm/b4/tree/main/mcp-b4i "mcp-b4i") | | [mcp-b4i](/tangentstorm/b4/tree/main/mcp-b4i "mcp-b4i") | | |
| [pas](/tangentstorm/b4/tree/main/pas "pas") | | [pas](/tangentstorm/b4/tree/main/pas "pas") | | |
| [ref](/tangentstorm/b4/tree/main/ref "ref") | | [ref](/tangentstorm/b4/tree/main/ref "ref") | | |
| [.gitignore](/tangentstorm/b4/blob/main/.gitignore ".gitignore") | | [.gitignore](/tangentstorm/b4/blob/main/.gitignore ".gitignore") | | |
| [ASSISTANTS.md](/tangentstorm/b4/blob/main/ASSISTANTS.md "ASSISTANTS.md") | | [ASSISTANTS.md](/tangentstorm/b4/blob/main/ASSISTANTS.md "ASSISTANTS.md") | | |
| [README.org](/tangentstorm/b4/blob/main/README.org "README.org") | | [README.org](/tangentstorm/b4/blob/main/README.org "README.org") | | |
| [b4-tests.org](/tangentstorm/b4/blob/main/b4-tests.org "b4-tests.org") | | [b4-tests.org](/tangentstorm/b4/blob/main/b4-tests.org "b4-tests.org") | | |
| [b4i](/tangentstorm/b4/blob/main/b4i "b4i") | | [b4i](/tangentstorm/b4/blob/main/b4i "b4i") | | |
| [b4i-tests.org](/tangentstorm/b4/blob/main/b4i-tests.org "b4i-tests.org") | | [b4i-tests.org](/tangentstorm/b4/blob/main/b4i-tests.org "b4i-tests.org") | | |
| [b4ix](/tangentstorm/b4/blob/main/b4ix "b4ix") | | [b4ix](/tangentstorm/b4/blob/main/b4ix "b4ix") | | |
| [b4s-tests.org](/tangentstorm/b4/blob/main/b4s-tests.org "b4s-tests.org") | | [b4s-tests.org](/tangentstorm/b4/blob/main/b4s-tests.org "b4s-tests.org") | | |
| [bios-tests.org](/tangentstorm/b4/blob/main/bios-tests.org "bios-tests.org") | | [bios-tests.org](/tangentstorm/b4/blob/main/bios-tests.org "bios-tests.org") | | |
| [goals.org](/tangentstorm/b4/blob/main/goals.org "goals.org") | | [goals.org](/tangentstorm/b4/blob/main/goals.org "goals.org") | | |
| [init.b4i](/tangentstorm/b4/blob/main/init.b4i "init.b4i") | | [init.b4i](/tangentstorm/b4/blob/main/init.b4i "init.b4i") | | |
| [plan.org](/tangentstorm/b4/blob/main/plan.org "plan.org") | | [plan.org](/tangentstorm/b4/blob/main/plan.org "plan.org") | | |
| [pre-tests.org](/tangentstorm/b4/blob/main/pre-tests.org "pre-tests.org") | | [pre-tests.org](/tangentstorm/b4/blob/main/pre-tests.org "pre-tests.org") | | |
| [test](/tangentstorm/b4/blob/main/test "test") | | [test](/tangentstorm/b4/blob/main/test "test") | | |
| [test-b4-b4a](/tangentstorm/b4/blob/main/test-b4-b4a "test-b4-b4a") | | [test-b4-b4a](/tangentstorm/b4/blob/main/test-b4-b4a "test-b4-b4a") | | |
| [test-b4-gd](/tangentstorm/b4/blob/main/test-b4-gd "test-b4-gd") | | [test-b4-gd](/tangentstorm/b4/blob/main/test-b4-gd "test-b4-gd") | | |
| [test-b4-j](/tangentstorm/b4/blob/main/test-b4-j "test-b4-j") | | [test-b4-j](/tangentstorm/b4/blob/main/test-b4-j "test-b4-j") | | |
| [test-b4-js](/tangentstorm/b4/blob/main/test-b4-js "test-b4-js") | | [test-b4-js](/tangentstorm/b4/blob/main/test-b4-js "test-b4-js") | | |
| [test-b4-lil](/tangentstorm/b4/blob/main/test-b4-lil "test-b4-lil") | | [test-b4-lil](/tangentstorm/b4/blob/main/test-b4-lil "test-b4-lil") | | |
| [test-b4-pas](/tangentstorm/b4/blob/main/test-b4-pas "test-b4-pas") | | [test-b4-pas](/tangentstorm/b4/blob/main/test-b4-pas "test-b4-pas") | | |
| [test-b4i-js](/tangentstorm/b4/blob/main/test-b4i-js "test-b4i-js") | | [test-b4i-js](/tangentstorm/b4/blob/main/test-b4i-js "test-b4i-js") | | |
| [test-b4i-lil](/tangentstorm/b4/blob/main/test-b4i-lil "test-b4i-lil") | | [test-b4i-lil](/tangentstorm/b4/blob/main/test-b4i-lil "test-b4i-lil") | | |
| [test-b4i-pas](/tangentstorm/b4/blob/main/test-b4i-pas "test-b4i-pas") | | [test-b4i-pas](/tangentstorm/b4/blob/main/test-b4i-pas "test-b4i-pas") | | |
| [test-b4s](/tangentstorm/b4/blob/main/test-b4s "test-b4s") | | [test-b4s](/tangentstorm/b4/blob/main/test-b4s "test-b4s") | | |
| [test-bios](/tangentstorm/b4/blob/main/test-bios "test-bios") | | [test-bios](/tangentstorm/b4/blob/main/test-bios "test-bios") | | |
| [test-pre](/tangentstorm/b4/blob/main/test-pre "test-pre") | | [test-pre](/tangentstorm/b4/blob/main/test-pre "test-pre") | | |
| View all files | | |
## Repository files navigation
* [README](#)
# The b4 virtual machine
# Demo
[![ref/b4ix-rosetta.png](/tangentstorm/b4/raw/main/ref/b4ix-rosetta.png)](/tangentstorm/b4/blob/main/ref/b4ix-rosetta.png)
The above screenshot is the `b4ix` enhanced interactive shell. The sceen is broken into three sections:
* on top, a view into the systems video buffer, which is pre-initialized with a logo from the bios.
* in the middle, an interactive shell for the `b4a` assembly language.
* at the bottom, a view of stacks and section of the machines ram
## explanation of the demo code
```
# https://rosettacode.org/wiki/Loops/For
:E lb 'e io rt # set up ^E to emit a character
:I cd cd du dc sw dc rt # set up ^I to fetch outer loop counter
:loop du .f du ^I sb c1 ad .f lb '. ^E .n lb '| ^E .n zp rt
5 loop
```
The `^E` syntax calls whatever function the `E` register is pointing at, and the assembler assigns it when it sees `:E`.
Here, `^E` loads the byte `'e` (quoted ascii char) and sends that as a command to the `io` op, which prints the next character on the stack.
The `^I` definition fetches the outer loop counter in a `.f``.n` (“for/next”) loop.
Since its a function call, we have to dig deep into the control stack (`cd` means copy from control stack to data stack), (`du`)plicate the counter, and then (`sw`)ap it with the return address so we can push that back onto the control stack (`dc` means data -> control), and then `rt` (return).
Then `:loop` dupes its argument and uses it as an argument to the `.f=/`.n= loop.
During these loops, the loop counter is on the control stack, so `^I` grabs it as explained earlier, but there is also a copy of the original loop length (5 in this case) on the data stack.
so `du ^I sb` duplicates the 5, subtracts the outer loop counter, and leaves the result on the stack.
`c1` is an op that adds the constant 1 to the stack, and `ad` adds the top two values, so `c1 ad` adds 1 to the previous expression to get the length of the inner loop.
`.f lb '. ^E .n` prints that many dots.
`lb '| ^E .n` prints the pipe character and ends the outer loop.
then `zp rt` removes that original `5` thats been sitting on the stack the whole time (passed in when we explicitly called `5 loop`) and returns to the calling function (in this case, the interactive “b4ix” shell.)
# About b4
**b4** is a tiny virtual machine, with a forth-like flavor.
There are currently five implementations:
* [./jlang/](/tangentstorm/b4/blob/main/jlang), implemented in [J](https://code.jsoftware.com/wiki/Main_Page).
* [./pas/](/tangentstorm/b4/blob/main/pas), implemented in [free pascal](https://www.freepascal.org/).
* [./lil/](/tangentstorm/b4/blob/main/lil), implemented in [lil](https://beyondloom.com/decker/lil.html).
* [./js/](/tangentstorm/b4/blob/main/js), implemented in javascript.
* [b4-gd](https://github.com/tangentstorm/b4-gd), implemented in GDScript for [Godot 4](https://docs.godotengine.org/en/stable/).
The implementations are kept in sync through the tests in [./b4-tests.org](/tangentstorm/b4/blob/main/b4-tests.org)
See [./bios/bios.b4a](/tangentstorm/b4/blob/main/bios/bios.b4a) for an example of b4 assembly language.
# Links
* [b4 github repo](https://github.com/tangentstorm/b4)
* twitter: [@tangentstorm](https://twitter.com/tangentstorm) / [#b4lang](https://twitter.com/#!/search/realtime/%23b4lang)
* reddit: [/r/b4lang](http://reddit.com/r/b4lang)
# Background
B4 is a forth-like virtual machine. Quick **intros to forth** (free and online):
* [Programming a Problem-Oriented Language](http://www.colorforth.com/POL.htm)
* [Starting Forth](http://www.forth.com/starting-forth/)
B4 was strongly influenced by the [ngaro virtual machine](http://retroforth.org/docs/The_Ngaro_Virtual_Machine.html) from retroforth 11,
as well as the [forth chips from greenarrays](https://www.greenarraychips.com/home/documents/index.php#architecture).
## About
b4 : a tiny forth-like virtual machine
[www.reddit.com/r/b4lang/](http://www.reddit.com/r/b4lang/ "http://www.reddit.com/r/b4lang/")
### Resources
[Readme](#readme-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/tangentstorm/b4/activity)
### Stars
[**39**
stars](/tangentstorm/b4/stargazers)
### Watchers
[**6**
watching](/tangentstorm/b4/watchers)
### Forks
[**4**
forks](/tangentstorm/b4/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Ftangentstorm%2Fb4&report=tangentstorm+%28user%29)
## [Releases](/tangentstorm/b4/releases)
No releases published
## [Packages 0](/users/tangentstorm/packages?repo_name=b4)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## [Contributors 3](/tangentstorm/b4/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [Pascal
34.8%](/tangentstorm/b4/search?l=pascal)
* [Python
22.4%](/tangentstorm/b4/search?l=python)
* [JavaScript
10.7%](/tangentstorm/b4/search?l=javascript)
* [TypeScript
8.5%](/tangentstorm/b4/search?l=typescript)
* [Forth
7.8%](/tangentstorm/b4/search?l=forth)
* [J
5.9%](/tangentstorm/b4/search?l=j)
* Other
9.9%
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,12 @@
# c2-for-me
**Source:** http://marc.tries.fed.wiki/view/c2-for-me/ward.eu.wiki.org/c2-for-me
c2 for me
Site Owned by: Marc Pierson
 
 

View File

@@ -0,0 +1,184 @@
# call versus branch-and-link
**Source:** https://muforth.dev/call-versus-branch-and-link/
Call versus branch-and-link muforth
# Call versus branch-and-link
---
### [Whats the big difference?](#whats-the-big-difference)
Years ago, while pondering the “nature” of threaded code something struck me: In a threaded code system the *called* routine decides whether or not to push a return address onto the call stack.
This is in contrast to native code running on “traditional” architectures with “call” instructions. Call instructions *always* push the return address, even when its unnecessary. (Its unnecessary when the code being is called is *leaf* routine one that makes no further calls. But the caller doesnt and cant! know this.)
RISC architects realized that always pushing the return address was inefficient doing so creates unnecessary memory traffic and instead of call instructions specified “branch and link” instructions.
Whats the difference?
Operationally, a call instruction does two things:
* pushes onto the stack the address of the following instruction
* jumps to the destination
A branch-and-link instruction maybe it should be called link-and-branch? also does two things:
* captures in a register (the “link” register) the address of the following instruction
* jumps to the destination
If the *called* code is a leaf routine, it doesnt need to push the link register onto the stack. It is careful, however, to preserve its value; then, at exit, it returns to its caller by jumping to the address in the link register.
If the called code *will* be making calls to other code, on entry it pushes the link register (to preserve it), and on exit it *first* pops and restores it, and then retuns to its caller as above, by jumping to the address in the register.
### [Not created equal](#not-created-equal)
There are two variations of branch-and-link:
* one that always uses the same link register (eg, ARM)
* one that allows specification of the link register (RISC-V, and probably others Im not a RISC expert. ;-)
The latter is much more powerful. If all your code does is “normal” calls and returns, the difference is unimportant. But there is a curious class of uses for which the difference is important: when using a branch-and-link to capture the following address for a purpose *other* than to return to it later.
Say whaaaaat? Why would you ever do this?
### [Creative misuse](#creative-misuse)
I mentioned in my discussion of [threaded code](/threaded-code/) that one can “misuse” a call instruction to capture the following address. This is sometimes useful when writing the “runtime” behaviors of Forth words. But using call in this way is inefficient: you capture the following address by pushing it, but then immediately pop it and do something with it.
Misusing branch-and-link instructions to do the same thing is much more efficient. The address is captured in a register, and the code moves on. No push and pop. (There *is* a jump involved, so perhaps a pipeline refill occurs.)
And if, for some reason, we want to do this twice, in immediate succession, we simply specify a different link register in each of the branch-and-links. (Hmm, and now we are perhaps doing *two* pipeline refills in quick succession...)
But again, why?
In a non-threaded implementation of Forths create/does words, this is *precisely* what happens. Ill explain how this works by first showing how it works in a ITC (indirect-threaded code) system, and then replace some pointers with jump-and-link instructions.
Well look how three kinds of Forth words are represented: colon words, variables, and “incrementers” (which are going to be defined via create/does).
Our example colon word was defined in Forth like this:
```
: 4* 2* 2* ;
```
and its compiled form looks like this:
```
4*
~~~~~~~~~~~
addr of NEST ( code field)
addr of 2* ( parameter field)
addr of 2*
addr of UNNEST
```
Our variable looks like this:
```
radix
~~~~~~~~~~~
addr of VARIABLE (code field)
2 (parameter field)
```
And our created word the most complicated of our examples was created by the following Forth code:
```
: incr create , does> @ + ;
4 incr cell+
```
To further complicate this example which is really the *key* to my argument we will assume a tethered cross-compiled Forth, which means that the words `create , does>` execute on the host machine, and the target contains only the *runtime* pieces. `cell+` and `incr` look like this:
```
cell+
+----------+
| addr |---+ ( code field)
+----------+ |
4 | ( parameter field)
|
incr |
~~~~~~~~~~~ |
jal DODOES <-+
addr of @
addr of +
addr of UNNEST
```
```
DODOES: Push IP onto R stack
Push pfa onto D stack
Execute NEXT
```
Two notes about `incr`. It is *not* a normal Forth word with a code field and a parameter field. It is like the built-in “runtimes” for colon words or variables. In this case unlike with VARIABLE or NEST we want to express the runtime in *Forth* code rather than machine code. But runtimes have to *start* with machine code. And a `does>` runtime has to do two things: nest the execution of Forth (just as we would do if we were calling a colon word), and push the pfa of the created word (`cell+` in our example.)
Since this behavior is common to all `does>` runtimes, we compile it *once* and `jal` to it.
Thus, `incr` *begins* with `jal DODOES`. This is the *one* place in an ITC system where *code* specific to an architecture has to be compiled into a words body. The Forth code in a parent (defining) word that specifies the execution behavior of child words ie, the code following `does>` has to be *prefixed* by machine code of some kind so that the code field in child words can point to it. Code fields *always* point to machine code.
Now for the point of this exercise. Lets convert these three examples to “native” code, using jump-and-link instructions in the bodies of colon words instead of lists of pointers. Note that we use two different link registers: `w` in code fields, and `ra` in colon word bodies.
```
4*
~~~~~~~~~~~
jal w NEST (code field)
jal ra 2* (parameter field)
jal ra 2*
jal ra UNNEST
```
NEST in this world changes slightly from the ITC version. Notice that the `jal w NEST` captures the pfa which is the address of the first call to `2*` in `w`. NEST now looks like this:
```
NEST: Push RA onto R stack
jr 0(w)
```
That `jr 0(w)` means “return to the body of the colon word and start executing the code there”.
Our variable looks like this:
```
radix
~~~~~~~~~~~
jal w VARIABLE (code field)
2 (parameter field)
```
Again, the `jal w VARIABLE` captures the pfa in `w`.
Since there is one more level of “nesting” in `does>` words, we need a *third* link register. Lets use x.
```
cell+
~~~~~~~~~~~
jal w INCR (code field)
4 (parameter field)
```
```
INCR: jal x DODOES
jal ra @
jal ra +
jal ra UNNEST
```
```
DODOES: Push RA onto R stack
Push W (pfa) onto D stack
jr 0(x)
```
The `jal w INCR` in `cell+` captures the pfa in `w`. The `jal x DODOES` in INCR captures the address of the Forth code that will be executed after W is pushed onto D stack. DODOES pushes both stacks, and then “returns” to the body of INCR.
Its convoluted, and its possibly inefficient because we are executing *three* `jal` instructions in quick succession, and probably causing a series of pipeline refills but its very little code, and its elegant in a twisted way. ;-)
---
[Send feedback](/cdn-cgi/l/email-protection#2f0a18180a191a0a191d0a19170a191e0a194b0a181c0a181b0a191a0a181d0a1b1f0a194a0a19160a194b0a191d0a194c0a191a0a194b0a191e0a191c0a19170a19160a194a0a191a0a181c0a1d4a0a191c0a19490a194b105c5a4d454a4c5b120a1a4d425a49405d5b470a1a4b0a1d1f6c4e43430a1d1f594a5d5c5a5c0a1d1f4d5d4e414c47024e414b0243464144) on this page (last edited 2017 May 01)
Browse [all pages](/all-pages/)
Return [home](/)

View File

@@ -0,0 +1,322 @@
# cmFORTH
**Source:** https://github.com/ForthHub/cmFORTH
GitHub - ForthHub/cmFORTH: Copy of cmFORTH
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FForthHub%2FcmFORTH)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FForthHub%2FcmFORTH)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=ForthHub%2FcmFORTH)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[ForthHub](/ForthHub)
/
**[cmFORTH](/ForthHub/cmFORTH)**
Public
* [Notifications](/login?return_to=%2FForthHub%2FcmFORTH) You must be signed in to change notification settings
* [Fork
8](/login?return_to=%2FForthHub%2FcmFORTH)
* [Star
40](/login?return_to=%2FForthHub%2FcmFORTH)
Copy of cmFORTH
[40
stars](/ForthHub/cmFORTH/stargazers) [8
forks](/ForthHub/cmFORTH/forks) [Branches](/ForthHub/cmFORTH/branches) [Tags](/ForthHub/cmFORTH/tags) [Activity](/ForthHub/cmFORTH/activity)
[Star](/login?return_to=%2FForthHub%2FcmFORTH)
[Notifications](/login?return_to=%2FForthHub%2FcmFORTH) You must be signed in to change notification settings
* [Code](/ForthHub/cmFORTH)
* [Issues
0](/ForthHub/cmFORTH/issues)
* [Pull requests
0](/ForthHub/cmFORTH/pulls)
* [Actions](/ForthHub/cmFORTH/actions)
* [Projects
0](/ForthHub/cmFORTH/projects)
* [Wiki](/ForthHub/cmFORTH/wiki)
* [Security
0](/ForthHub/cmFORTH/security)
* [Insights](/ForthHub/cmFORTH/pulse)
Additional navigation options
* [Code](/ForthHub/cmFORTH)
* [Issues](/ForthHub/cmFORTH/issues)
* [Pull requests](/ForthHub/cmFORTH/pulls)
* [Actions](/ForthHub/cmFORTH/actions)
* [Projects](/ForthHub/cmFORTH/projects)
* [Wiki](/ForthHub/cmFORTH/wiki)
* [Security](/ForthHub/cmFORTH/security)
* [Insights](/ForthHub/cmFORTH/pulse)
# ForthHub/cmFORTH
master
[Branches](/ForthHub/cmFORTH/branches)[Tags](/ForthHub/cmFORTH/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[2 Commits](/ForthHub/cmFORTH/commits/master/) 2 Commits | | |
| [README](/ForthHub/cmFORTH/blob/master/README "README") | | [README](/ForthHub/cmFORTH/blob/master/README "README") | | |
| [cmforth.fth](/ForthHub/cmFORTH/blob/master/cmforth.fth "cmforth.fth") | | [cmforth.fth](/ForthHub/cmFORTH/blob/master/cmforth.fth "cmforth.fth") | | |
| [cmforth.txt](/ForthHub/cmFORTH/blob/master/cmforth.txt "cmforth.txt") | | [cmforth.txt](/ForthHub/cmFORTH/blob/master/cmforth.txt "cmforth.txt") | | |
| View all files | | |
## Repository files navigation
* [README](#)
```
Chuck Moore's Forth for the Novix NC4016, dated December 1987.
Code is in cmforth.fth, shadow blocks in cmforth.txt. They are combined
side-by-side in the 'combined' branch.
```
## About
Copy of cmFORTH
### Topics
[forth](/topics/forth "Topic: forth")
### Resources
[Readme](#readme-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/ForthHub/cmFORTH/activity)
[Custom properties](/ForthHub/cmFORTH/custom-properties)
### Stars
[**40**
stars](/ForthHub/cmFORTH/stargazers)
### Watchers
[**7**
watching](/ForthHub/cmFORTH/watchers)
### Forks
[**8**
forks](/ForthHub/cmFORTH/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2FForthHub%2FcmFORTH&report=ForthHub+%28user%29)
## [Releases](/ForthHub/cmFORTH/releases)
No releases published
## [Packages 0](/orgs/ForthHub/packages?repo_name=cmFORTH)
No packages published
## Languages
* [Forth
100.0%](/ForthHub/cmFORTH/search?l=forth)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,338 @@
# deckload
**Source:** https://github.com/JosephOziel/deckload
GitHub - JosephOziel/deckload: Compiled functional language
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FJosephOziel%2Fdeckload)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2FJosephOziel%2Fdeckload)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=JosephOziel%2Fdeckload)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[JosephOziel](/JosephOziel)
/
**[deckload](/JosephOziel/deckload)**
Public
* [Notifications](/login?return_to=%2FJosephOziel%2Fdeckload) You must be signed in to change notification settings
* [Fork
1](/login?return_to=%2FJosephOziel%2Fdeckload)
* [Star
4](/login?return_to=%2FJosephOziel%2Fdeckload)
Compiled functional language
### License
[MIT license](/JosephOziel/deckload/blob/main/LICENSE)
[4
stars](/JosephOziel/deckload/stargazers) [1
fork](/JosephOziel/deckload/forks) [Branches](/JosephOziel/deckload/branches) [Tags](/JosephOziel/deckload/tags) [Activity](/JosephOziel/deckload/activity)
[Star](/login?return_to=%2FJosephOziel%2Fdeckload)
[Notifications](/login?return_to=%2FJosephOziel%2Fdeckload) You must be signed in to change notification settings
* [Code](/JosephOziel/deckload)
* [Issues
0](/JosephOziel/deckload/issues)
* [Pull requests
0](/JosephOziel/deckload/pulls)
* [Actions](/JosephOziel/deckload/actions)
* [Projects
0](/JosephOziel/deckload/projects)
* [Security
0](/JosephOziel/deckload/security)
* [Insights](/JosephOziel/deckload/pulse)
Additional navigation options
* [Code](/JosephOziel/deckload)
* [Issues](/JosephOziel/deckload/issues)
* [Pull requests](/JosephOziel/deckload/pulls)
* [Actions](/JosephOziel/deckload/actions)
* [Projects](/JosephOziel/deckload/projects)
* [Security](/JosephOziel/deckload/security)
* [Insights](/JosephOziel/deckload/pulse)
# JosephOziel/deckload
main
[Branches](/JosephOziel/deckload/branches)[Tags](/JosephOziel/deckload/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[69 Commits](/JosephOziel/deckload/commits/main/) 69 Commits | | |
| [backend-c](/JosephOziel/deckload/tree/main/backend-c "backend-c") | | [backend-c](/JosephOziel/deckload/tree/main/backend-c "backend-c") | | |
| [backend-factor](/JosephOziel/deckload/tree/main/backend-factor "backend-factor") | | [backend-factor](/JosephOziel/deckload/tree/main/backend-factor "backend-factor") | | |
| [examples](/JosephOziel/deckload/tree/main/examples "examples") | | [examples](/JosephOziel/deckload/tree/main/examples "examples") | | |
| [ir](/JosephOziel/deckload/tree/main/ir "ir") | | [ir](/JosephOziel/deckload/tree/main/ir "ir") | | |
| [parser](/JosephOziel/deckload/tree/main/parser "parser") | | [parser](/JosephOziel/deckload/tree/main/parser "parser") | | |
| [.gitattributes](/JosephOziel/deckload/blob/main/.gitattributes ".gitattributes") | | [.gitattributes](/JosephOziel/deckload/blob/main/.gitattributes ".gitattributes") | | |
| [LICENSE](/JosephOziel/deckload/blob/main/LICENSE "LICENSE") | | [LICENSE](/JosephOziel/deckload/blob/main/LICENSE "LICENSE") | | |
| [README.md](/JosephOziel/deckload/blob/main/README.md "README.md") | | [README.md](/JosephOziel/deckload/blob/main/README.md "README.md") | | |
| [TODO](/JosephOziel/deckload/blob/main/TODO "TODO") | | [TODO](/JosephOziel/deckload/blob/main/TODO "TODO") | | |
| [deckload.factor](/JosephOziel/deckload/blob/main/deckload.factor "deckload.factor") | | [deckload.factor](/JosephOziel/deckload/blob/main/deckload.factor "deckload.factor") | | |
| [spec.markdown](/JosephOziel/deckload/blob/main/spec.markdown "spec.markdown") | | [spec.markdown](/JosephOziel/deckload/blob/main/spec.markdown "spec.markdown") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [MIT license](#)
# Deckload
```
Best low level language compiling to x86 assembly based on rho calculus (tree rewriting + lambda calculus). also postfix notation.
```
## About
Compiled functional language
### Resources
[Readme](#readme-ov-file)
### License
[MIT license](#MIT-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/JosephOziel/deckload/activity)
### Stars
[**4**
stars](/JosephOziel/deckload/stargazers)
### Watchers
[**1**
watching](/JosephOziel/deckload/watchers)
### Forks
[**1**
fork](/JosephOziel/deckload/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2FJosephOziel%2Fdeckload&report=JosephOziel+%28user%29)
## [Releases](/JosephOziel/deckload/releases)
No releases published
## [Packages 0](/users/JosephOziel/packages?repo_name=deckload)
No packages published
## [Contributors 2](/JosephOziel/deckload/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [Factor
73.3%](/JosephOziel/deckload/search?l=factor)
* [C
26.7%](/JosephOziel/deckload/search?l=c)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,338 @@
# easyforth
**Source:** https://github.com/skilldrick/easyforth
GitHub - skilldrick/easyforth: Learn Forth!
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fskilldrick%2Feasyforth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fskilldrick%2Feasyforth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=skilldrick%2Feasyforth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[skilldrick](/skilldrick)
/
**[easyforth](/skilldrick/easyforth)**
Public
* [Notifications](/login?return_to=%2Fskilldrick%2Feasyforth) You must be signed in to change notification settings
* [Fork
46](/login?return_to=%2Fskilldrick%2Feasyforth)
* [Star
379](/login?return_to=%2Fskilldrick%2Feasyforth)
Learn Forth!
[skilldrick.github.io/easyforth/](http://skilldrick.github.io/easyforth/ "http://skilldrick.github.io/easyforth/")
[379
stars](/skilldrick/easyforth/stargazers) [46
forks](/skilldrick/easyforth/forks) [Branches](/skilldrick/easyforth/branches) [Tags](/skilldrick/easyforth/tags) [Activity](/skilldrick/easyforth/activity)
[Star](/login?return_to=%2Fskilldrick%2Feasyforth)
[Notifications](/login?return_to=%2Fskilldrick%2Feasyforth) You must be signed in to change notification settings
* [Code](/skilldrick/easyforth)
* [Issues
9](/skilldrick/easyforth/issues)
* [Pull requests
3](/skilldrick/easyforth/pulls)
* [Actions](/skilldrick/easyforth/actions)
* [Projects
0](/skilldrick/easyforth/projects)
* [Wiki](/skilldrick/easyforth/wiki)
* [Security
0](/skilldrick/easyforth/security)
* [Insights](/skilldrick/easyforth/pulse)
Additional navigation options
* [Code](/skilldrick/easyforth)
* [Issues](/skilldrick/easyforth/issues)
* [Pull requests](/skilldrick/easyforth/pulls)
* [Actions](/skilldrick/easyforth/actions)
* [Projects](/skilldrick/easyforth/projects)
* [Wiki](/skilldrick/easyforth/wiki)
* [Security](/skilldrick/easyforth/security)
* [Insights](/skilldrick/easyforth/pulse)
# skilldrick/easyforth
gh-pages
[Branches](/skilldrick/easyforth/branches)[Tags](/skilldrick/easyforth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[165 Commits](/skilldrick/easyforth/commits/gh-pages/) 165 Commits | | |
| [\_includes](/skilldrick/easyforth/tree/gh-pages/_includes "_includes") | | [\_includes](/skilldrick/easyforth/tree/gh-pages/_includes "_includes") | | |
| [\_layouts](/skilldrick/easyforth/tree/gh-pages/_layouts "_layouts") | | [\_layouts](/skilldrick/easyforth/tree/gh-pages/_layouts "_layouts") | | |
| [javascripts](/skilldrick/easyforth/tree/gh-pages/javascripts "javascripts") | | [javascripts](/skilldrick/easyforth/tree/gh-pages/javascripts "javascripts") | | |
| [stylesheets](/skilldrick/easyforth/tree/gh-pages/stylesheets "stylesheets") | | [stylesheets](/skilldrick/easyforth/tree/gh-pages/stylesheets "stylesheets") | | |
| [test](/skilldrick/easyforth/tree/gh-pages/test "test") | | [test](/skilldrick/easyforth/tree/gh-pages/test "test") | | |
| [.gitignore](/skilldrick/easyforth/blob/gh-pages/.gitignore ".gitignore") | | [.gitignore](/skilldrick/easyforth/blob/gh-pages/.gitignore ".gitignore") | | |
| [README.md](/skilldrick/easyforth/blob/gh-pages/README.md "README.md") | | [README.md](/skilldrick/easyforth/blob/gh-pages/README.md "README.md") | | |
| [\_config.yml](/skilldrick/easyforth/blob/gh-pages/_config.yml "_config.yml") | | [\_config.yml](/skilldrick/easyforth/blob/gh-pages/_config.yml "_config.yml") | | |
| [index.markdown](/skilldrick/easyforth/blob/gh-pages/index.markdown "index.markdown") | | [index.markdown](/skilldrick/easyforth/blob/gh-pages/index.markdown "index.markdown") | | |
| [params.json](/skilldrick/easyforth/blob/gh-pages/params.json "params.json") | | [params.json](/skilldrick/easyforth/blob/gh-pages/params.json "params.json") | | |
| [todo](/skilldrick/easyforth/blob/gh-pages/todo "todo") | | [todo](/skilldrick/easyforth/blob/gh-pages/todo "todo") | | |
| View all files | | |
## Repository files navigation
* [README](#)
# Easy Forth
Along the lines of [Easy 6502](http://skilldrick.github.io/easy6502/), Easy
Forth is a small ebook for learning the Forth language. It includes a
JavaScript Forth interpreter inline, making it easy to try writing small Forth
programs.
## About
Learn Forth!
[skilldrick.github.io/easyforth/](http://skilldrick.github.io/easyforth/ "http://skilldrick.github.io/easyforth/")
### Resources
[Readme](#readme-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/skilldrick/easyforth/activity)
### Stars
[**379**
stars](/skilldrick/easyforth/stargazers)
### Watchers
[**23**
watching](/skilldrick/easyforth/watchers)
### Forks
[**46**
forks](/skilldrick/easyforth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fskilldrick%2Feasyforth&report=skilldrick+%28user%29)
## [Releases](/skilldrick/easyforth/releases)
No releases published
## [Packages 0](/users/skilldrick/packages?repo_name=easyforth)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [JavaScript
92.7%](/skilldrick/easyforth/search?l=javascript)
* [CSS
3.5%](/skilldrick/easyforth/search?l=css)
* [HTML
2.1%](/skilldrick/easyforth/search?l=html)
* [Forth
1.7%](/skilldrick/easyforth/search?l=forth)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,372 @@
# fiveth
**Source:** https://github.com/dramforever/fiveth
GitHub - dramforever/fiveth: A stack-based language implemented in RISC-V assembly
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fdramforever%2Ffiveth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fdramforever%2Ffiveth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=dramforever%2Ffiveth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[dramforever](/dramforever)
/
**[fiveth](/dramforever/fiveth)**
Public
* [Notifications](/login?return_to=%2Fdramforever%2Ffiveth) You must be signed in to change notification settings
* [Fork
0](/login?return_to=%2Fdramforever%2Ffiveth)
* [Star
17](/login?return_to=%2Fdramforever%2Ffiveth)
A stack-based language implemented in RISC-V assembly
[17
stars](/dramforever/fiveth/stargazers) [0
forks](/dramforever/fiveth/forks) [Branches](/dramforever/fiveth/branches) [Tags](/dramforever/fiveth/tags) [Activity](/dramforever/fiveth/activity)
[Star](/login?return_to=%2Fdramforever%2Ffiveth)
[Notifications](/login?return_to=%2Fdramforever%2Ffiveth) You must be signed in to change notification settings
* [Code](/dramforever/fiveth)
* [Issues
0](/dramforever/fiveth/issues)
* [Pull requests
0](/dramforever/fiveth/pulls)
* [Actions](/dramforever/fiveth/actions)
* [Projects
0](/dramforever/fiveth/projects)
* [Security
0](/dramforever/fiveth/security)
* [Insights](/dramforever/fiveth/pulse)
Additional navigation options
* [Code](/dramforever/fiveth)
* [Issues](/dramforever/fiveth/issues)
* [Pull requests](/dramforever/fiveth/pulls)
* [Actions](/dramforever/fiveth/actions)
* [Projects](/dramforever/fiveth/projects)
* [Security](/dramforever/fiveth/security)
* [Insights](/dramforever/fiveth/pulse)
# dramforever/fiveth
main
[Branches](/dramforever/fiveth/branches)[Tags](/dramforever/fiveth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[96 Commits](/dramforever/fiveth/commits/main/) 96 Commits | | |
| [docs](/dramforever/fiveth/tree/main/docs "docs") | | [docs](/dramforever/fiveth/tree/main/docs "docs") | | |
| [src](/dramforever/fiveth/tree/main/src "src") | | [src](/dramforever/fiveth/tree/main/src "src") | | |
| [.envrc](/dramforever/fiveth/blob/main/.envrc ".envrc") | | [.envrc](/dramforever/fiveth/blob/main/.envrc ".envrc") | | |
| [.gitignore](/dramforever/fiveth/blob/main/.gitignore ".gitignore") | | [.gitignore](/dramforever/fiveth/blob/main/.gitignore ".gitignore") | | |
| [Makefile](/dramforever/fiveth/blob/main/Makefile "Makefile") | | [Makefile](/dramforever/fiveth/blob/main/Makefile "Makefile") | | |
| [README.md](/dramforever/fiveth/blob/main/README.md "README.md") | | [README.md](/dramforever/fiveth/blob/main/README.md "README.md") | | |
| [config.mk](/dramforever/fiveth/blob/main/config.mk "config.mk") | | [config.mk](/dramforever/fiveth/blob/main/config.mk "config.mk") | | |
| [flake.lock](/dramforever/fiveth/blob/main/flake.lock "flake.lock") | | [flake.lock](/dramforever/fiveth/blob/main/flake.lock "flake.lock") | | |
| [flake.nix](/dramforever/fiveth/blob/main/flake.nix "flake.nix") | | [flake.nix](/dramforever/fiveth/blob/main/flake.nix "flake.nix") | | |
| [shell.nix](/dramforever/fiveth/blob/main/shell.nix "shell.nix") | | [shell.nix](/dramforever/fiveth/blob/main/shell.nix "shell.nix") | | |
| View all files | | |
## Repository files navigation
* [README](#)
# Fiveth
A stack-based language implemented in RISC-V assembly.
## Building and running Fiveth
* Edit `config.mk` to suit your environment
* `make` to build the program
With the default config this should end a message like:
```
* Build complete: build/fiveth
```
The default configuration is to run an interactive Fiveth shell that works under
a 64-bit RISC-V Linux environment. You can now:
* `make qemu` to run it in QEMU user-mode emulation
* `make run` to run it directly, if you are actually on RISC-V
Try typing some simple Fiveth programs. Outputs are shown after a semicolon.
```
0 > 1 2 + . ; 3
0 > 10 [ . ] count ; 0 1 2 3 4 5 6 7 8 9
0 > "Hello, world!" s. ; Hello, world!
```
Press Ctrl-D to quit. [`docs/shell.md`](/dramforever/fiveth/blob/main/docs/shell.md) has more details on
running and using the Fiveth interactive shell.
## Installing the required tools
On Ubuntu 22.04:
```
# apt install qemu-user make
# # If using GNU toolchain
# apt install gcc-riscv64-linux-gnu
# # If using LLVM toolchain
# apt install clang lld
```
If you have Nix, you can try to use the provided `shell.nix` or `flake.nix`.
On other systems, you can try to acquire a LLVM toolchain or a RISC-V toolchain,
as well as GNU make. To run Fiveth in an emulator, `qemu-riscv64` can be used to
emulate a Linux binary but is only supported on Linux hosts.
## About
A stack-based language implemented in RISC-V assembly
### Topics
[assembly](/topics/assembly "Topic: assembly")
[riscv](/topics/riscv "Topic: riscv")
[forth-like](/topics/forth-like "Topic: forth-like")
### Resources
[Readme](#readme-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/dramforever/fiveth/activity)
### Stars
[**17**
stars](/dramforever/fiveth/stargazers)
### Watchers
[**2**
watching](/dramforever/fiveth/watchers)
### Forks
[**0**
forks](/dramforever/fiveth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fdramforever%2Ffiveth&report=dramforever+%28user%29)
## [Releases](/dramforever/fiveth/releases)
No releases published
## Languages
* [Assembly
89.1%](/dramforever/fiveth/search?l=assembly)
* [Makefile
7.1%](/dramforever/fiveth/search?l=makefile)
* [C
2.5%](/dramforever/fiveth/search?l=c)
* [Nix
1.3%](/dramforever/fiveth/search?l=nix)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,5 @@
# formic
**Source:** https://formic.id
formic.id

View File

@@ -0,0 +1,821 @@
# foth (forth in go)
**Source:** https://github.com/skx/foth
GitHub - skx/foth: Tutorial-style FORTH implementation written in golang
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fskx%2Ffoth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fskx%2Ffoth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=skx%2Ffoth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
[skx](/skx)
/
**[foth](/skx/foth)**
Public archive
* [Notifications](/login?return_to=%2Fskx%2Ffoth) You must be signed in to change notification settings
* [Fork
7](/login?return_to=%2Fskx%2Ffoth)
* [Star
94](/login?return_to=%2Fskx%2Ffoth)
Tutorial-style FORTH implementation written in golang
### License
[GPL-2.0 license](/skx/foth/blob/master/LICENSE)
[94
stars](/skx/foth/stargazers) [7
forks](/skx/foth/forks) [Branches](/skx/foth/branches) [Tags](/skx/foth/tags) [Activity](/skx/foth/activity)
[Star](/login?return_to=%2Fskx%2Ffoth)
[Notifications](/login?return_to=%2Fskx%2Ffoth) You must be signed in to change notification settings
* [Code](/skx/foth)
* [Issues
0](/skx/foth/issues)
* [Pull requests
0](/skx/foth/pulls)
* [Actions](/skx/foth/actions)
* [Security
0](/skx/foth/security)
* [Insights](/skx/foth/pulse)
Additional navigation options
* [Code](/skx/foth)
* [Issues](/skx/foth/issues)
* [Pull requests](/skx/foth/pulls)
* [Actions](/skx/foth/actions)
* [Security](/skx/foth/security)
* [Insights](/skx/foth/pulse)
# skx/foth
master
[Branches](/skx/foth/branches)[Tags](/skx/foth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[128 Commits](/skx/foth/commits/master/) 128 Commits | | |
| [.github](/skx/foth/tree/master/.github ".github") | | [.github](/skx/foth/tree/master/.github ".github") | | |
| [foth](/skx/foth/tree/master/foth "foth") | | [foth](/skx/foth/tree/master/foth "foth") | | |
| [part1](/skx/foth/tree/master/part1 "part1") | | [part1](/skx/foth/tree/master/part1 "part1") | | |
| [part2](/skx/foth/tree/master/part2 "part2") | | [part2](/skx/foth/tree/master/part2 "part2") | | |
| [part3](/skx/foth/tree/master/part3 "part3") | | [part3](/skx/foth/tree/master/part3 "part3") | | |
| [part4](/skx/foth/tree/master/part4 "part4") | | [part4](/skx/foth/tree/master/part4 "part4") | | |
| [part5](/skx/foth/tree/master/part5 "part5") | | [part5](/skx/foth/tree/master/part5 "part5") | | |
| [part6](/skx/foth/tree/master/part6 "part6") | | [part6](/skx/foth/tree/master/part6 "part6") | | |
| [part7](/skx/foth/tree/master/part7 "part7") | | [part7](/skx/foth/tree/master/part7 "part7") | | |
| [.gitignore](/skx/foth/blob/master/.gitignore ".gitignore") | | [.gitignore](/skx/foth/blob/master/.gitignore ".gitignore") | | |
| [LICENSE](/skx/foth/blob/master/LICENSE "LICENSE") | | [LICENSE](/skx/foth/blob/master/LICENSE "LICENSE") | | |
| [README.md](/skx/foth/blob/master/README.md "README.md") | | [README.md](/skx/foth/blob/master/README.md "README.md") | | |
| [go.mod](/skx/foth/blob/master/go.mod "go.mod") | | [go.mod](/skx/foth/blob/master/go.mod "go.mod") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [GPL-2.0 license](#)
[![GoDoc](https://camo.githubusercontent.com/4204d449c8ac17196f1a3a04ee0beb1b8c1b33e9cc5a11749b70dbac04462146/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d676f646f63266d6573736167653d7265666572656e636526636f6c6f723d626c7565)](https://pkg.go.dev/github.com/skx/foth@v0.3.0/foth?tab=overview)
[![Go Report Card](https://camo.githubusercontent.com/75428032b736d4c96cb10a52bea074f46d24d022713c7391693717e8b7bcc7fa/68747470733a2f2f676f7265706f7274636172642e636f6d2f62616467652f6769746875622e636f6d2f736b782f666f7468)](https://goreportcard.com/report/github.com/skx/foth)
[![license](https://camo.githubusercontent.com/006d1a4a70625534d799b46a49525f5e5be4dc2093a9059bf0fc5e00ce7d566c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736b782f666f74682e737667)](https://github.com/skx/foth/blob/master/LICENSE)
[![Release](https://camo.githubusercontent.com/92dbc628aa2ba50da637c4609b1eb0f73eccd0092975d54b431101c557c96a07/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f736b782f666f74682e737667)](https://github.com/skx/foth/releases/latest)
* [foth](#foth)
+ [Features](#features)
+ [Installation](#installation)
+ [Embedded Usage](#embedded-usage)
+ [Anti-Features](#anti-features)
+ [Implementation Approach](#implementation-approach)
+ [Implementation Overview](#implementation-overview)
- [Part 1](#part-1) - Minimal initial-implementation.
- [Part 2](#part-2) - Hard-coded recursive word definitions.
- [Part 3](#part-3) - Allow defining minimal words via the REPL.
- [Part 4](#part-4) - Allow defining improved words via the REPL.
- [Part 5](#part-5) - Allow executing loops via `do`/`loop`.
- [Part 6](#part-6) - Allow conditional execution via `if`/`then`.
- [Part 7](#part-7) - Added minimal support for strings.
- [Final Revision](#final-revision) - Idiomatic Go, test-cases, and many new words
+ [BUGS](#bugs)
- [loops](#loops) - zero expected-iterations actually runs once
+ [See Also](#see-also)
+ [Github Setup](#github-setup)
# foth
A simple implementation of a FORTH-like language, hence *foth* which is
close to *forth*.
If you're new to FORTH then [the wikipedia page](https://en.wikipedia.org/wiki/Forth_(programming_language)) is a good starting point, and there are more good reads online such as:
* [Forth in 7 easy steps](https://jeelabs.org/article/1612b/)
+ Just ignore any mention of the return-stack!
* [Starting FORTH](https://www.forth.com/starting-forth/)
+ A complete book, but the navigation of this site is non-obvious.
In brief FORTH is a stack-based language, which uses Reverse Polish notation. The basic *thing* in Forth is the "word", which is a named data item, subroutine, or operator. Programming consists largely of defining new words, which are stored in a so-called "dictionary", in terms of existing ones. Iteratively building up a local DSL suited to your particular task.
This repository was created by following the brief tutorial posted within the following Hacker News thread, designed to demonstrate how you could implement something *like* FORTH, in a series of simple steps:
* <https://news.ycombinator.com/item?id=13082825>
The comment-thread shows example-code and pseudo-code in C, of course this repository is written in Go.
## Features
The end-result of this work is a simple scripting-language which you could easily embed within your golang application, allowing users to write simple FORTH-like scripts. We implement the kind of features a FORTH-user would expect:
* Comments between `(` and `)` are ignored, as expected.
+ Single-line comments `\` to the end of the line are also supported.
* Support for floating-point numbers (anything that will fit inside a `float64`).
* Reverse-Polish mathematical operations.
+ Including support for `abs`, `min`, `max`, etc.
* Support for printing the top-most stack element (`.`, or `print`).
* Support for outputting ASCII characters (`emit`).
* Support for outputting strings (`." Hello, World "`).
+ Some additional string-support for counting lengths, etc.
* Support for basic stack operations (`clearstack`, `drop`, `dup`, `over`, `swap`, `.s`)
* Support for loops, via `do`/`loop`.
* Support for conditional-execution, via `if`, `else`, and `then`.
* Support for declaring variables with `variable`, and getting/setting their values with `@` and `!` respectively.
* Execute files specified on the command-line.
+ If no arguments are supplied run a simple REPL instead.
* A standard library is loaded, from the present directory, if it is present.
+ See what we load by default in [foth/foth.4th](/skx/foth/blob/master/foth/foth.4th).
* The use of recursive definitions, for example:
+ `: factorial recursive dup 1 > if dup 1 - factorial * then ;`
## Installation
You can find binary releases of the final-version upon the [project release page](https://github.com/skx/foth/releases), but if you prefer you can install from source easily.
Either run this to download and install the binary:
```
$ go get github.com/skx/foth/foth@v0.5.0
```
Or clone this repository, and build the executable like so:
```
cd foth
go build .
./foth
```
The executable will try to load [foth.4th](/skx/foth/blob/master/foth/foth.4th) from the current-directory, so you'll want to fetch that too. But otherwise it should work as you'd expect - the startup-file defines several useful words, so running without it is a little annoying but it isn't impossible.
## Embedded Usage
Although this is a minimal interpreter it *can* be embedded within a Golang host-application, allowing users to write scripts to control it.
As an example of this I put together a simple demo:
* <https://github.com/skx/turtle>
This embeds the interpreter within an application, and defines some new words to allow the user to create graphics - in the style of [turtle](https://en.wikipedia.org/wiki/Turtle_graphics).
## Anti-Features
The obvious omission from this implementation is support for strings in the general case (string support is pretty limited to calling strlen, and printing strings which are constant and "inline").
We also lack the meta-programming facilities that FORTH users would expect, in a FORTH system it is possible to implement new control-flow systems, for example, by working with words and the control-flow directly. Instead in this system these things are unavailable, and the implementation of IF/DO/LOOP/ELSE/THEN are handled in the golang-code in a way users cannot modify.
Basically we ignore the common FORTH-approach of using a return-stack, and implementing a VM with "cells". Instead we just emulate the *behaviour* of the more advanced words:
* So we implement `if` or `do`/`loop` in a hard-coded fashion.
+ That means we can't allow a user to define `while`, or similar.
+ But otherwise our language is flexible enough to allow *real* work to be done with it.
## Implementation Approach
The code evolves through a series of simple steps, [contained in the comment-thread](https://news.ycombinator.com/item?id=13082825), ultimately ending with a [final revision](#final-revision) which is actually useful, usable, and pretty flexible.
While it would certainly be possible to further improve the implementation I'm going to declare this project as "almost complete" for my own tastes:
* I'll make minor changes, as they occur to me.
* Comments, test-cases, and similar are fair game.
* Outright crashes will be resolved, if I spot any.
* But no major new features will be added.
If **you** wanted to extend things further then there are some obvious things to work upon:
* Adding more of the "standard" FORTH-words.
+ For example we're missing `pow`, etc.
* Enhanced the string-support, to allow an input/read from the user, and other primitives.
+ strcat, strstr, and similar C-like operations would be useful.
* Simplify the conditional/loop handling.
+ Both of these probably involve using a proper return-stack.
+ This would have the side-effect of allowing new control-flow primitives to be added.
+ As well as more meta-programming.
Pull-requests adding additional functionality will be accepted with thanks.
## Implementation Overview
Each subdirectory within this repository gets a bit further down the comment-chain.
In terms of implementation two files are *largely* unchanged in each example:
* `stack.go`, which contains a simple stack of `float64` numbers.
* `main.go`, contains a simple REPL/driver.
+ The final few examples will also allow loading a startup-file, if present.
Each example builds upon the previous ones, with a pair of implementation files that change:
* `builtins.go` contains the forth-words implemented in golang.
* `eval.go` is the workhorse which implements to FORTH-like interpreter.
+ This allows executing existing words, and defining new ones.
### Part 1
Part one of the implementation only deals with hard-coded execution
of "words". It only supports the basic mathematical operations, along
with the ability to print the top-most entry of the stack:
```
cd part1
go build .
./part1
> 2 3 + 4 5 + * print
45.000000
^D
```
See [part1/](/skx/foth/blob/master/part1) for details.
### Part 2
Part two allows the definition of new words in terms of existing ones,
which can even happen recursively.
We've added `dup` to pop an item off the stack, and push it back twice, which
has the ultimate effect of duplicating it.
To demonstrate the self-definition there is the new function `square` which
squares the number at the top of the stack.
```
cd part2
go build .
./part2
> 3 square .
9.000000
> 3 dup + .
6.000000
^D
```
See [part2/](/skx/foth/blob/master/part2) for details.
### Part 3
Part three allows the user to define their own words, right from within the
REPL!
This means we've removed the `square` implementation, because you can add your own:
```
cd part3
go build .
./part3
> : square dup * ;
> : cube dup square * ;
> 3 cube .
27.000000
> 25 square .
625.000000
^D
```
See [part3/](/skx/foth/blob/master/part3) for details.
**NOTE**: We don't support using numbers in definitions, yet. That will come in part4!
### Part 4
Part four allows the user to define their own words, including the use of numbers, from within the REPL. Here the magic is handling the input of numbers when in "compiling mode".
To support this we switched our `Words` array from `int` to `float64`, specifically to ensure that we could continue to support floating-point numbers.
```
cd part4
go build .
./part4
> : add1 1 + ;
> -100 add1 .
-99.000000
> 4 add1 .
5.000000
^D
```
See [part4/](/skx/foth/blob/master/part4) for details.
### Part 5
This part adds `do` and `loop`, allowing simple loops, and `emit` which outputs the ASCII character stored in the topmost stack-entry.
Sample usage would look like this:
```
> : cr 10 emit ;
> : star 42 emit ;
> : stars 0 do star loop cr ;
> 4 stars
****
> 5 stars
*****
> 1 stars
*
> 10 stars
**********
^D
```
Here we've defined two new words `cr` to print a return, and `star` to output a single star.
We then defined the `stars` word to use a loop to print the given number of stars.
(Note that the character `*` has the ASCII code 42).
`do` and `loop` are pretty basic, allowing only loops to be handled which increment by one each iteration. You cannot use the standard `i` token to get the current index, instead you can see them on the stack:
* Top-most entry is the current index.
* Second entry is the limit.
So to write out numbers you could try something like this, using `dup` to duplicate the current offset within the loop:
```
> : l 10 0 do dup . loop ;
> l
0.000000
1.000000
2.000000
..
8.000000
9.000000
> : nums 10 0 do dup 48 + emit loop ;
> nums
0123456789>
```
See [part5/](/skx/foth/blob/master/part5) for details.
### Part 6
This update adds a lot of new primitives to our dictionary of predefined words:
* `drop` - Removes an item from the stack.
* `swap` - Swaps the top-most two stack-items.
* `words` - Outputs a list of all defined words.
* `<`, `<=`, `=` (`==` as a synonym), `>`, `>=`
+ Remove two items from the stack, and compare them appropriately.
+ If the condition is true push `1` onto the stack, otherwise `0`.
* The biggest feature here is the support for using `if` & `then`, which allow conditional actions to be carried out.
+ (These are why we added the comparison operations.)
In addition to these new primitives the driver, `main.go`, was updated to load and evaluate [foth.4th](/skx/foth/blob/master/part6/foth.4th) on-startup if it is present.
Sample usage:
```
cd part6
go build .
./part6
> : hot 72 emit 111 emit 116 emit 10 emit ;
> : cold 67 emit 111 emit 108 emit 100 emit 10 emit ;
> : test_hot 0 > if hot then ;
> : test_cold 0 <= if cold then ;
> : test dup test_hot test_cold ;
> 10 test
Hot
> 0 test
Cold
> -1 test
Cold
> 10 test_hot
Hot
> 10 test_cold
> -1 test_cold
Cold
^D
```
See [part6/](/skx/foth/blob/master/part6) for the code.
**NOTE**: The `if` handler allows:
```
: foo $COND IF word1 [word2 .. wordN] then [more_word1 more_word2 ..] ;
```
This means if the condition is true then we run `word1`, `word2` .. and otherwise we skip them, and continue running after the `then` statement. Specifically note there is **no support for `else`**. That is why we call the `test_host` and `test_cold` words in our `test` definition. Each word tests separately.
As an example:
```
> : foo 0 > if star star then star star cr ;
```
If the test-passes, because you give a positive number, you'll see FOUR stars. if it fails you just get TWO:
```
> 2 foo
****
> 1 foo
****
> 0 foo
**
> -1 foo
**
```
This is because the code is synonymous with the following C-code:
```
if ( x > 0 ) {
printf("*");
printf("*");
}
printf("*");
printf("*");
printf("\n");
```
I found this page useful, it also documents `invert` which I added for completeness:
* <https://www.forth.com/starting-forth/4-conditional-if-then-statements/>
### Part 7
This update adds a basic level of support for strings.
* When we see a string we store it in an array of strings.
* We then push the offset of the new string entry onto the stack.
* This allows it to be referenced and used.
* Three new words are added:
+ `strings` Return the number of strings we've seen/stored.
+ `strlen` show the length of the string at the given address.
+ `strprn` print the string at the given address.
Sample usage:
```
cd part7
go build .
./part7
> : steve "steve" ;
> steve strlen .
5
> steve strprn .
steve
^D
```
See [part7/](/skx/foth/blob/master/part7) for the code.
### Final Revision
The final version, stored beneath [foth/](/skx/foth/blob/master/foth), is pretty similar to the previous part from an end-user point of view, however there have been a lot of changes behind the scenes:
* We've added near 100% test-coverage.
* We've added a simple [lexer](/skx/foth/blob/master/foth/lexer) to tokenize our input.
+ This was required to allow us to ignore comments, and handle string literals.
+ Merely splitting input-strings at whitespace characters would have made either of those impossible to handle correctly.
* The `if` handling has been updated to support an `else`-branch, the general form is now:
+ `$COND IF word1 [ .. wordN ] else alt_word1 [.. altN] then [more_word1 more_word2 ..]`
* It is now possible to use `if`, `else`, `then`, `do`, and `loop` outside word-definitions.
+ i.e. Immediately in the REPL.
* `do`/`loop` loops can be nested.
+ And the new words `i` and `m` used to return the current index and maximum index, respectively.
* There were many new words defined in the go-core:
+ `.s` to show the stack-contents.
+ `clearstack` to clear the stack.
+ `debug` to change the debug-flag.
+ `debug?` to reveal the status.
+ `dump` dumps the compiled form of the given word.
- You can view the definitions of all available words this:
- `#words 0 do i dump loop`
+ `#words` to return the number of defined words.
+ Variables can be declared, by name, with `variable`, and the value of the variable can be set/retrieved with `@` and `!` respectively.
- See this demonstrated in the [standard library](/skx/foth/blob/master/foth/foth.4th)
* There were some new words defined in the [standard library](/skx/foth/blob/master/foth/foth.4th)
+ e.g. `abs`, `even?`, `negate`, `odd?`,
* Removed all calls to `os.Exit()`
+ We now return `error` objects where appropriate, allowing the caller to detect problems.
* It is now possible to redefine existing words.
* Execute any files specified on the command line.
+ If no files are specified run the REPL.
* We've added support for recursive definitions, in #16 for example allowing:
+ `: factorial recursive dup 1 > if dup 1 - factorial * then ;`
See [foth/](/skx/foth/blob/master/foth) for the implementation.
## BUGS
A brief list of known-issues:
### Loops
The handling of loops isn't correct when there should be zero-iterations:
```
> : star 42 emit ;
> : stars 0 do star loop 10 emit ;
> 3 stars
***
> 1 stars
*
> 0 stars
*
^D
```
**NOTE**: In `gforth` the result of `0 0 do ... loop` is actually an **infinite** loop, which is perhaps worse!
In our `stars` definition we handle this case by explicitly testing the loop
value before we proceed, only running the loop if the value is non-zero.
# See Also
This repository was put together after [experimenting with a scripting language](https://github.com/skx/monkey/), an [evaluation engine](https://github.com/skx/evalfilter/), putting together a [TCL-like scripting language](https://github.com/skx/critical), writing a [BASIC interpreter](https://github.com/skx/gobasic) and creating [yet another lisp](https://github.com/skx/yal).
I've also played around with a couple of compilers which might be interesting to refer to:
* Brainfuck compiler:
+ <https://github.com/skx/bfcc/>
* A math-compiler:
+ <https://github.com/skx/math-compiler>
# Github Setup
This repository is configured to run tests upon every commit, and when pull-requests are created/updated. The testing is carried out via [.github/run-tests.sh](/skx/foth/blob/master/.github/run-tests.sh) which is used by the [github-action-tester](https://github.com/skx/github-action-tester) action.
## About
Tutorial-style FORTH implementation written in golang
### Topics
[go](/topics/go "Topic: go")
[golang](/topics/golang "Topic: golang")
[tutorial](/topics/tutorial "Topic: tutorial")
[interpreter](/topics/interpreter "Topic: interpreter")
[scripting-language](/topics/scripting-language "Topic: scripting-language")
[forth](/topics/forth "Topic: forth")
[tutorial-code](/topics/tutorial-code "Topic: tutorial-code")
[forth-like](/topics/forth-like "Topic: forth-like")
### Resources
[Readme](#readme-ov-file)
### License
[GPL-2.0 license](#GPL-2.0-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/skx/foth/activity)
### Stars
[**94**
stars](/skx/foth/stargazers)
### Watchers
[**0**
watching](/skx/foth/watchers)
### Forks
[**7**
forks](/skx/foth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fskx%2Ffoth&report=skx+%28user%29)
## [Releases 2](/skx/foth/releases)
[v0.5.0
Latest
Feb 15, 2024](/skx/foth/releases/tag/v0.5.0)
[+ 1 release](/skx/foth/releases)
## [Packages 0](/users/skx/packages?repo_name=foth)
No packages published
## Languages
* [Go
95.3%](/skx/foth/search?l=go)
* [Forth
4.7%](/skx/foth/search?l=forth)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,427 @@
# guitarvydas/forthish
**Source:** https://github.com/guitarvydas/forthish
GitHub - guitarvydas/forthish
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fguitarvydas%2Fforthish)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fguitarvydas%2Fforthish)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=guitarvydas%2Fforthish)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[guitarvydas](/guitarvydas)
/
**[forthish](/guitarvydas/forthish)**
Public
* [Notifications](/login?return_to=%2Fguitarvydas%2Fforthish) You must be signed in to change notification settings
* [Fork
0](/login?return_to=%2Fguitarvydas%2Fforthish)
* [Star
1](/login?return_to=%2Fguitarvydas%2Fforthish)
[1
star](/guitarvydas/forthish/stargazers) [0
forks](/guitarvydas/forthish/forks) [Branches](/guitarvydas/forthish/branches) [Tags](/guitarvydas/forthish/tags) [Activity](/guitarvydas/forthish/activity)
[Star](/login?return_to=%2Fguitarvydas%2Fforthish)
[Notifications](/login?return_to=%2Fguitarvydas%2Fforthish) You must be signed in to change notification settings
* [Code](/guitarvydas/forthish)
* [Issues
0](/guitarvydas/forthish/issues)
* [Pull requests
0](/guitarvydas/forthish/pulls)
* [Actions](/guitarvydas/forthish/actions)
* [Projects
0](/guitarvydas/forthish/projects)
* [Security
0](/guitarvydas/forthish/security)
* [Insights](/guitarvydas/forthish/pulse)
Additional navigation options
* [Code](/guitarvydas/forthish)
* [Issues](/guitarvydas/forthish/issues)
* [Pull requests](/guitarvydas/forthish/pulls)
* [Actions](/guitarvydas/forthish/actions)
* [Projects](/guitarvydas/forthish/projects)
* [Security](/guitarvydas/forthish/security)
* [Insights](/guitarvydas/forthish/pulse)
# guitarvydas/forthish
main
[Branches](/guitarvydas/forthish/branches)[Tags](/guitarvydas/forthish/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[26 Commits](/guitarvydas/forthish/commits/main/) 26 Commits | | |
| [.hg](/guitarvydas/forthish/tree/main/.hg ".hg") | | [.hg](/guitarvydas/forthish/tree/main/.hg ".hg") | | |
| [.obsidian](/guitarvydas/forthish/tree/main/.obsidian ".obsidian") | | [.obsidian](/guitarvydas/forthish/tree/main/.obsidian ".obsidian") | | |
| [assets](/guitarvydas/forthish/tree/main/assets "assets") | | [assets](/guitarvydas/forthish/tree/main/assets "assets") | | |
| [basic](/guitarvydas/forthish/tree/main/basic "basic") | | [basic](/guitarvydas/forthish/tree/main/basic "basic") | | |
| [course](/guitarvydas/forthish/tree/main/course "course") | | [course](/guitarvydas/forthish/tree/main/course "course") | | |
| [frish](/guitarvydas/forthish/tree/main/frish "frish") | | [frish](/guitarvydas/forthish/tree/main/frish "frish") | | |
| [.gitignore](/guitarvydas/forthish/blob/main/.gitignore ".gitignore") | | [.gitignore](/guitarvydas/forthish/blob/main/.gitignore ".gitignore") | | |
| [.hgignore](/guitarvydas/forthish/blob/main/.hgignore ".hgignore") | | [.hgignore](/guitarvydas/forthish/blob/main/.hgignore ".hgignore") | | |
| [INSTALL-hg.md](/guitarvydas/forthish/blob/main/INSTALL-hg.md "INSTALL-hg.md") | | [INSTALL-hg.md](/guitarvydas/forthish/blob/main/INSTALL-hg.md "INSTALL-hg.md") | | |
| [INSTALL.md](/guitarvydas/forthish/blob/main/INSTALL.md "INSTALL.md") | | [INSTALL.md](/guitarvydas/forthish/blob/main/INSTALL.md "INSTALL.md") | | |
| [README.md](/guitarvydas/forthish/blob/main/README.md "README.md") | | [README.md](/guitarvydas/forthish/blob/main/README.md "README.md") | | |
| View all files | | |
## Repository files navigation
* [README](#)
# Forth in $WHATEVER
This is a collection of Forth (or Forth-like) implementations in various languages. It is intended to provide examples of how you can leverage Forth to simplify and add extensibility to your programs.
## Python Implementations
### [simple.py](/guitarvydas/forthish/blob/main/simple.py?rev=tip)
The simplest thing that could be called a Forth (Mr. Moore will probably disagree with me). However, it provides a useful parser, stack and interface to the host system. Words in this implementation:
* **+** ( a b -- sum) Add two numbers on top of stack.
* **-** ( a b -- difference) Subtracts top number from next on stack.
* **.** ( n --) Pop top of stack and print it.
* **.s** ( --) Print contents of stack (nondestructive).
* **bye** ( --) Exit interpreter.
* **interpret** ( string --) Execute word on top of stack.
* **swap** ( a b -- b a) Swaps top two items on stack.
* **word** ( c -- string) Collect characters in input stream up to character c.
### [fram.py](/guitarvydas/forthish/blob/main/fram.py?rev=tip)
This implements a semi-traditional Forth dictionary in the RAM array. Words are stored with a name field, link field and code field. Instead of finding things directly with a Python dictionary, the `'` word searches for the xt, or "execution token", to be executed.
In real terms, a little slower, but offers some exciting benefits, which I'll explore later.
* **'** ( name -- xt) Finds word's xt in dictionary.
* **execute** ( xt --) Executes the code at xt.
* **negate** ( n -- -n) Makes number negative (or positive, if you use it twice).
* **words** ( --) Prints list of all words in dictionary.
### [fvars.py](/guitarvydas/forthish/blob/main/fvars.py?rev=tip)
Now we're getting into memory manipulations with variables and such. This introduces some new stuff in the code field -- a constant or variable is just like any other Forth word, except the code retrieves the values (or address of the values, for variables).
* **!** ( v a --) Store value at address a.
* **,** ( v --) Store v as next value in dictionary.
* **@** ( a -- v) Fetch value from address a.
* **constant** ( name | v --) Create constant with value v.
* **create** ( name | --) Create word name in dictionary.
* **dump** ( start n --) Dump n values starting from RAM address a.
* **variable** ( name | v --) Create variable name, with initial value v.
### [fcomp.py](/guitarvydas/forthish/blob/main/fcomp.py?rev=tip)
Stuff is getting tricky now... This implements user definitions. Also reworks some previous words.
#### Variables
* **state** Variable for interpreter state -- 0 = interpret, 1 = compile.
#### Special Words for Compilation
These words are used during compilation to handle literal values and control flow. You will generally not need to use them.
* **(literal)** Used when compiling literal values in definitions.
* **branch** Unconditional branch.
* **0branch** Branch on false.
#### Words for Definitions
The colon and semicolon begin and end a Forth definition. The if/else/then triad can only be used inside a definition (in traditional Forth).
* **:** ( name | --) Start compiling new definition.
* **;** ( --) End definition.
* **if** ( f --) Evaluate based on flag f.
* **else** ( --) What to do when if is false.
* **then** ( --) End if/else/then clause, continue with normal execution.
#### Regular Words
This is a grab bag of stuff that I found useful as I went. Notably, the `"` (quote) word is state-smart, meaning it can be used outside and inside a definition. Now that you know that, forget it...
* **find** ( name | -- name 0|xt 1|xt -1) Search for word name.
* **(** ( --) Start inline comment, reads until closing paren.
* **."** ( --) Prints text up to closing quote.
* **"** ( -- s) Reads text up to closing quote as a string, puts on stack.
* **/** ( a b -- div) Divides a by b.
* **\*** ( a b -- product) Multiplies a times b.
* **cr** ( --) Carriage return.
* **emit** ( c --) Prints ascii character c.
* **dup** ( a -- a a) Duplicate TOS.
* **drop** ( a --) Discards TOS.
If you care, this is effectively a DTC (Direct Threaded Code) implementation.
*Explanation of how colon definitions work goes here...*
## References
Some links to more information that will help in understanding why you might do with this and what to do with it once you've got it. If nothing else, please read Walker's essay at the first link.
### Essential
* [ATLAST](https://www.fourmilab.ch/atlast/) -- My first encounter with this concept, written by the legendary John Walker. He explains it better than I can.
* [Starting Forth](https://www.forth.com/starting-forth/) -- Classic Forth tutorial and textbook. Don't be fooled by the illustrations, this book not only teaches you how to use Forth, but actually gives you enough information to write your own as well.
* [Levels of FORTH](https://www.forth.org/literature/forthlev.html) -- Glen Haydon's taxonomy of Forth implementations, slightly outdated, but useful if you're trying to figure out what functionality to implement next.
### Supplemental
* [Forth Standard](https://forth-standard.org/standard/words) Yes, Forth has a language standard. Don't feel like you need to follow it slavishly, though...
* [JONESFORTH](https://github.com/nornagon/jonesforth/blob/master/jonesforth.S) -- A full implementation of Forth, in assembly.
* [Thinking Forth -- A Language and Philosophy for Solving Problems](https://www.forth.com/wp-content/uploads/2018/11/thinking-forth-color.pdf) -- Leo Brodie's masterwork, read this to figure out how to *really* use your new Forth implementation.
### Historical
* [Forth - The Early Years](https://colorforth.github.io/HOPL.html) -- Potted history of Forth, by its creator, Chuck Moore.
* [Programming a Problem Oriented Language](https://archive.org/details/chuck-moore-forth-book/page/10/mode/2up) -- Unpublished book by Chuck Moore describing early Forth.
## About
No description, website, or topics provided.
### Resources
[Readme](#readme-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/guitarvydas/forthish/activity)
### Stars
[**1**
star](/guitarvydas/forthish/stargazers)
### Watchers
[**0**
watching](/guitarvydas/forthish/watchers)
### Forks
[**0**
forks](/guitarvydas/forthish/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fguitarvydas%2Fforthish&report=guitarvydas+%28user%29)
## [Releases](/guitarvydas/forthish/releases)
No releases published
## [Packages 0](/users/guitarvydas/packages?repo_name=forthish)
No packages published
## Languages
* [Python
66.6%](/guitarvydas/forthish/search?l=python)
* [JavaScript
22.6%](/guitarvydas/forthish/search?l=javascript)
* [HTML
10.4%](/guitarvydas/forthish/search?l=html)
* Other
0.4%
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,5 @@
# iNet
**Source:** https://inet.run
iNet

View File

@@ -0,0 +1,384 @@
# jombloforth (x64 Jonesforth)
**Source:** https://github.com/matematikaadit/jombloforth
GitHub - matematikaadit/jombloforth: Minimal FORTH interpreter for 64-bit Linux systems. Based on jonesforth.
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fmatematikaadit%2Fjombloforth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fmatematikaadit%2Fjombloforth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=matematikaadit%2Fjombloforth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[matematikaadit](/matematikaadit)
/
**[jombloforth](/matematikaadit/jombloforth)**
Public
* [Notifications](/login?return_to=%2Fmatematikaadit%2Fjombloforth) You must be signed in to change notification settings
* [Fork
5](/login?return_to=%2Fmatematikaadit%2Fjombloforth)
* [Star
28](/login?return_to=%2Fmatematikaadit%2Fjombloforth)
Minimal FORTH interpreter for 64-bit Linux systems. Based on jonesforth.
### License
[Unlicense license](/matematikaadit/jombloforth/blob/master/UNLICENSE.txt)
[28
stars](/matematikaadit/jombloforth/stargazers) [5
forks](/matematikaadit/jombloforth/forks) [Branches](/matematikaadit/jombloforth/branches) [Tags](/matematikaadit/jombloforth/tags) [Activity](/matematikaadit/jombloforth/activity)
[Star](/login?return_to=%2Fmatematikaadit%2Fjombloforth)
[Notifications](/login?return_to=%2Fmatematikaadit%2Fjombloforth) You must be signed in to change notification settings
* [Code](/matematikaadit/jombloforth)
* [Issues
0](/matematikaadit/jombloforth/issues)
* [Pull requests
0](/matematikaadit/jombloforth/pulls)
* [Actions](/matematikaadit/jombloforth/actions)
* [Projects
0](/matematikaadit/jombloforth/projects)
* [Security
0](/matematikaadit/jombloforth/security)
* [Insights](/matematikaadit/jombloforth/pulse)
Additional navigation options
* [Code](/matematikaadit/jombloforth)
* [Issues](/matematikaadit/jombloforth/issues)
* [Pull requests](/matematikaadit/jombloforth/pulls)
* [Actions](/matematikaadit/jombloforth/actions)
* [Projects](/matematikaadit/jombloforth/projects)
* [Security](/matematikaadit/jombloforth/security)
* [Insights](/matematikaadit/jombloforth/pulse)
# matematikaadit/jombloforth
master
[Branches](/matematikaadit/jombloforth/branches)[Tags](/matematikaadit/jombloforth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[93 Commits](/matematikaadit/jombloforth/commits/master/) 93 Commits | | |
| [debug](/matematikaadit/jombloforth/tree/master/debug "debug") | | [debug](/matematikaadit/jombloforth/tree/master/debug "debug") | | |
| [experiment](/matematikaadit/jombloforth/tree/master/experiment "experiment") | | [experiment](/matematikaadit/jombloforth/tree/master/experiment "experiment") | | |
| [original](/matematikaadit/jombloforth/tree/master/original "original") | | [original](/matematikaadit/jombloforth/tree/master/original "original") | | |
| [tests](/matematikaadit/jombloforth/tree/master/tests "tests") | | [tests](/matematikaadit/jombloforth/tree/master/tests "tests") | | |
| [.gitignore](/matematikaadit/jombloforth/blob/master/.gitignore ".gitignore") | | [.gitignore](/matematikaadit/jombloforth/blob/master/.gitignore ".gitignore") | | |
| [Makefile](/matematikaadit/jombloforth/blob/master/Makefile "Makefile") | | [Makefile](/matematikaadit/jombloforth/blob/master/Makefile "Makefile") | | |
| [README.md](/matematikaadit/jombloforth/blob/master/README.md "README.md") | | [README.md](/matematikaadit/jombloforth/blob/master/README.md "README.md") | | |
| [UNLICENSE.txt](/matematikaadit/jombloforth/blob/master/UNLICENSE.txt "UNLICENSE.txt") | | [UNLICENSE.txt](/matematikaadit/jombloforth/blob/master/UNLICENSE.txt "UNLICENSE.txt") | | |
| [jombloforth.asm](/matematikaadit/jombloforth/blob/master/jombloforth.asm "jombloforth.asm") | | [jombloforth.asm](/matematikaadit/jombloforth/blob/master/jombloforth.asm "jombloforth.asm") | | |
| [jombloforth.f](/matematikaadit/jombloforth/blob/master/jombloforth.f "jombloforth.f") | | [jombloforth.f](/matematikaadit/jombloforth/blob/master/jombloforth.f "jombloforth.f") | | |
| [unistd\_64.inc](/matematikaadit/jombloforth/blob/master/unistd_64.inc "unistd_64.inc") | | [unistd\_64.inc](/matematikaadit/jombloforth/blob/master/unistd_64.inc "unistd_64.inc") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [Unlicense license](#)
# jombloforth
Minimal FORTH interpreter for 64-bit Linux systems. Based on
jonesforth tutorial.
## Compile
You needs make, nasm, and ld to build the executable. Runs the following to build them
```
make jombloforth
```
## Running
For a full forth system, runs:
```
make run
```
The interpreter will starts accepting input from stdin.
## Quick Forth Tutorial
After the interpreter starts, you can execute any forth command defined in the system. For example, adding two number and display it.
```
42 24 + . CR
```
Will print 66 followed by newline.
Defining new word and runs it:
```
: double DUP + ;
100 double . CR
```
Will print 200.
To exit the program, press CTRL+D
## License
UNLICENSE. See [UNLICENSE.txt](/matematikaadit/jombloforth/blob/master/UNLICENSE.txt)
## About
Minimal FORTH interpreter for 64-bit Linux systems. Based on jonesforth.
### Topics
[assembly](/topics/assembly "Topic: assembly")
[x64](/topics/x64 "Topic: x64")
[x86-64](/topics/x86-64 "Topic: x86-64")
[forth](/topics/forth "Topic: forth")
[nasm](/topics/nasm "Topic: nasm")
### Resources
[Readme](#readme-ov-file)
### License
[Unlicense license](#Unlicense-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/matematikaadit/jombloforth/activity)
### Stars
[**28**
stars](/matematikaadit/jombloforth/stargazers)
### Watchers
[**1**
watching](/matematikaadit/jombloforth/watchers)
### Forks
[**5**
forks](/matematikaadit/jombloforth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fmatematikaadit%2Fjombloforth&report=matematikaadit+%28user%29)
## [Releases](/matematikaadit/jombloforth/releases)
No releases published
## [Packages 0](/users/matematikaadit/packages?repo_name=jombloforth)
No packages published
## Languages
* [Assembly
85.7%](/matematikaadit/jombloforth/search?l=assembly)
* [Forth
13.4%](/matematikaadit/jombloforth/search?l=forth)
* Other
0.9%
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,390 @@
# kcats
**Source:** https://github.com/skyrod-vactai/kcats
GitHub - skyrod-vactai/kcats: A stack-based programming language based on Joy
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fskyrod-vactai%2Fkcats)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fskyrod-vactai%2Fkcats)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=skyrod-vactai%2Fkcats)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[skyrod-vactai](/skyrod-vactai)
/
**[kcats](/skyrod-vactai/kcats)**
Public
* [Notifications](/login?return_to=%2Fskyrod-vactai%2Fkcats) You must be signed in to change notification settings
* [Fork
1](/login?return_to=%2Fskyrod-vactai%2Fkcats)
* [Star
8](/login?return_to=%2Fskyrod-vactai%2Fkcats)
A stack-based programming language based on Joy
### License
[WTFPL license](/skyrod-vactai/kcats/blob/master/LICENSE-WTFPL)
[8
stars](/skyrod-vactai/kcats/stargazers) [1
fork](/skyrod-vactai/kcats/forks) [Branches](/skyrod-vactai/kcats/branches) [Tags](/skyrod-vactai/kcats/tags) [Activity](/skyrod-vactai/kcats/activity)
[Star](/login?return_to=%2Fskyrod-vactai%2Fkcats)
[Notifications](/login?return_to=%2Fskyrod-vactai%2Fkcats) You must be signed in to change notification settings
* [Code](/skyrod-vactai/kcats)
* [Issues
0](/skyrod-vactai/kcats/issues)
* [Pull requests
0](/skyrod-vactai/kcats/pulls)
* [Discussions](/skyrod-vactai/kcats/discussions)
* [Actions](/skyrod-vactai/kcats/actions)
* [Projects
0](/skyrod-vactai/kcats/projects)
* [Security
0](/skyrod-vactai/kcats/security)
* [Insights](/skyrod-vactai/kcats/pulse)
Additional navigation options
* [Code](/skyrod-vactai/kcats)
* [Issues](/skyrod-vactai/kcats/issues)
* [Pull requests](/skyrod-vactai/kcats/pulls)
* [Discussions](/skyrod-vactai/kcats/discussions)
* [Actions](/skyrod-vactai/kcats/actions)
* [Projects](/skyrod-vactai/kcats/projects)
* [Security](/skyrod-vactai/kcats/security)
* [Insights](/skyrod-vactai/kcats/pulse)
# skyrod-vactai/kcats
master
[Branches](/skyrod-vactai/kcats/branches)[Tags](/skyrod-vactai/kcats/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[1,445 Commits](/skyrod-vactai/kcats/commits/master/) 1,445 Commits | | |
| [.cargo](/skyrod-vactai/kcats/tree/master/.cargo ".cargo") | | [.cargo](/skyrod-vactai/kcats/tree/master/.cargo ".cargo") | | |
| [.devcontainer](/skyrod-vactai/kcats/tree/master/.devcontainer ".devcontainer") | | [.devcontainer](/skyrod-vactai/kcats/tree/master/.devcontainer ".devcontainer") | | |
| [.github/workflows](/skyrod-vactai/kcats/tree/master/.github/workflows "This path skips through empty directories") | | [.github/workflows](/skyrod-vactai/kcats/tree/master/.github/workflows "This path skips through empty directories") | | |
| [ai-model-training](/skyrod-vactai/kcats/tree/master/ai-model-training "ai-model-training") | | [ai-model-training](/skyrod-vactai/kcats/tree/master/ai-model-training "ai-model-training") | | |
| [edn-format](/skyrod-vactai/kcats/tree/master/edn-format "edn-format") | | [edn-format](/skyrod-vactai/kcats/tree/master/edn-format "edn-format") | | |
| [emacs](/skyrod-vactai/kcats/tree/master/emacs "emacs") | | [emacs](/skyrod-vactai/kcats/tree/master/emacs "emacs") | | |
| [examples](/skyrod-vactai/kcats/tree/master/examples "examples") | | [examples](/skyrod-vactai/kcats/tree/master/examples "examples") | | |
| [Cargo.toml](/skyrod-vactai/kcats/blob/master/Cargo.toml "Cargo.toml") | | [Cargo.toml](/skyrod-vactai/kcats/blob/master/Cargo.toml "Cargo.toml") | | |
| [LICENSE-WTFPL](/skyrod-vactai/kcats/blob/master/LICENSE-WTFPL "LICENSE-WTFPL") | | [LICENSE-WTFPL](/skyrod-vactai/kcats/blob/master/LICENSE-WTFPL "LICENSE-WTFPL") | | |
| [README.md](/skyrod-vactai/kcats/blob/master/README.md "README.md") | | [README.md](/skyrod-vactai/kcats/blob/master/README.md "README.md") | | |
| [book-of-kcats.org](/skyrod-vactai/kcats/blob/master/book-of-kcats.org "book-of-kcats.org") | | [book-of-kcats.org](/skyrod-vactai/kcats/blob/master/book-of-kcats.org "book-of-kcats.org") | | |
| [build.rs](/skyrod-vactai/kcats/blob/master/build.rs "build.rs") | | [build.rs](/skyrod-vactai/kcats/blob/master/build.rs "build.rs") | | |
| [docs-custom.css](/skyrod-vactai/kcats/blob/master/docs-custom.css "docs-custom.css") | | [docs-custom.css](/skyrod-vactai/kcats/blob/master/docs-custom.css "docs-custom.css") | | |
| [emacs-ide.org](/skyrod-vactai/kcats/blob/master/emacs-ide.org "emacs-ide.org") | | [emacs-ide.org](/skyrod-vactai/kcats/blob/master/emacs-ide.org "emacs-ide.org") | | |
| [export.el](/skyrod-vactai/kcats/blob/master/export.el "export.el") | | [export.el](/skyrod-vactai/kcats/blob/master/export.el "export.el") | | |
| [kcats-repl.gif](/skyrod-vactai/kcats/blob/master/kcats-repl.gif "kcats-repl.gif") | | [kcats-repl.gif](/skyrod-vactai/kcats/blob/master/kcats-repl.gif "kcats-repl.gif") | | |
| [kcats.org](/skyrod-vactai/kcats/blob/master/kcats.org "kcats.org") | | [kcats.org](/skyrod-vactai/kcats/blob/master/kcats.org "kcats.org") | | |
| [kcats.png](/skyrod-vactai/kcats/blob/master/kcats.png "kcats.png") | | [kcats.png](/skyrod-vactai/kcats/blob/master/kcats.png "kcats.png") | | |
| [lexicon.org](/skyrod-vactai/kcats/blob/master/lexicon.org "lexicon.org") | | [lexicon.org](/skyrod-vactai/kcats/blob/master/lexicon.org "lexicon.org") | | |
| [lib-toolchain-env.sh](/skyrod-vactai/kcats/blob/master/lib-toolchain-env.sh "lib-toolchain-env.sh") | | [lib-toolchain-env.sh](/skyrod-vactai/kcats/blob/master/lib-toolchain-env.sh "lib-toolchain-env.sh") | | |
| [production.org\_archive](/skyrod-vactai/kcats/blob/master/production.org_archive "production.org_archive") | | [production.org\_archive](/skyrod-vactai/kcats/blob/master/production.org_archive "production.org_archive") | | |
| [scratch.org](/skyrod-vactai/kcats/blob/master/scratch.org "scratch.org") | | [scratch.org](/skyrod-vactai/kcats/blob/master/scratch.org "scratch.org") | | |
| [tangle.el](/skyrod-vactai/kcats/blob/master/tangle.el "tangle.el") | | [tangle.el](/skyrod-vactai/kcats/blob/master/tangle.el "tangle.el") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [WTFPL license](#)
# The kcats Programming language
[Get started!](https://skyrod-vactai.github.io/kcats/book-of-kcats.html)
# Other Documentation
* [Lexicon](https://skyrod-vactai.github.io/kcats/lexicon.html)
* [The Implementation](https://skyrod-vactai.github.io/kcats/production.html)
# Contributing
## Issue reporting
Use github issues <https://github.com/skyrod-vactai/kcats/issues> if that's easiest.
Recommended: Instead of opening a github issue, create a fork and add a TODO subheading to the Issues heading in the respective `.org` file. You can edit org files right on github, in your own fork.
* For bugs add issues here under Issues heading in production.org
* For documentation problems add issues here under Issues heading in book-of-kcats.org
Then submit it as a pull request.
To see the status, check your PR. It will have more commits by the developers added to it.
## Other feedback
Please do report design improvements you'd like to see - for example, inconsistencies in how words expect stack arguments to be, ways to make the standard library easier to work with, etc.
## About
A stack-based programming language based on Joy
### Resources
[Readme](#readme-ov-file)
### License
[WTFPL license](#WTFPL-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/skyrod-vactai/kcats/activity)
### Stars
[**8**
stars](/skyrod-vactai/kcats/stargazers)
### Watchers
[**1**
watching](/skyrod-vactai/kcats/watchers)
### Forks
[**1**
fork](/skyrod-vactai/kcats/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fskyrod-vactai%2Fkcats&report=skyrod-vactai+%28user%29)
## [Releases 26](/skyrod-vactai/kcats/releases)
[Release v1.0.0-6
Latest
May 16, 2025](/skyrod-vactai/kcats/releases/tag/v1.0.0-6)
[+ 25 releases](/skyrod-vactai/kcats/releases)
## [Packages 0](/users/skyrod-vactai/packages?repo_name=kcats)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## [Contributors 2](/skyrod-vactai/kcats/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [Rust
76.4%](/skyrod-vactai/kcats/search?l=rust)
* [Emacs Lisp
17.1%](/skyrod-vactai/kcats/search?l=emacs-lisp)
* [CSS
4.0%](/skyrod-vactai/kcats/search?l=css)
* [Python
1.6%](/skyrod-vactai/kcats/search?l=python)
* [Shell
0.9%](/skyrod-vactai/kcats/search?l=shell)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,68 @@
# kitten
**Source:** https://kittenlang.org
Kitten Programming Language
[Kitten](/)
* [Introduction](/intro/)
* [FAQ](/faq/)
* [Source](https://github.com/evincarofautumn/kitten/)
# Learn
* [FAQ](/faq/)
* [Introduction](/intro/)
* [Tutorial](/tutorial/)
* [Documentation](/documentation/)
# Contribute
* [Source](https://github.com/evincarofautumn/kitten)
* [Issues](https://github.com/evincarofautumn/kitten/issues)
* [IRC](irc://freenode.net/#concatenative)
# [The Kitten Programming Language](#the-kitten-programming-language)
**Kitten** is a statically typed, stack-based functional programming language designed to be simple and fast. It is a *concatenative* language, combining aspects of imperative and pure functional programming. There is [an introduction](/intro/) available and a [tutorial](/tutorial/) in progress.
## [Features](#features)
Concatenative Programming
: A compositional style of programming to make refactoring easier and improve code reuse.
Static Types
: Type inference based on HindleyMilner to help improve correctness and performance.
Permissions
: A system of effect types to control where side-effects are allowed.
Deterministic Resource Management
: Automatic management of memory and resources with no garbage collector.
## [Examples](#examples)
### [Hello world](#hello-world)
```
"meow" say // Kittens don't speak English.
```
### [Hello user](#hello-user)
```
define greet (List<Char> -> +IO):
-> name;
["Hello, ", name, "!"] concat say
"What is your name? " ask
greet
```
### [Larger examples](#larger-examples)
* [99 Bottles of Beer](https://github.com/evincarofautumn/kitten/blob/129d4bc7e5658a03cc765358ba0a1aba2dbf1c73/examples/beer.ktn)
* [Tic Tac Toe](https://github.com/evincarofautumn/kitten/blob/129d4bc7e5658a03cc765358ba0a1aba2dbf1c73/examples/tictactoe.ktn)
The [source code](https://github.com/evincarofautumn/kitten) is hosted on GitHub, and you can join [#concatenative on Freenode](irc://freenode.net/#concatenative) to keep up with the latest developments.

View File

@@ -0,0 +1,433 @@
# lbForth
**Source:** https://github.com/larsbrinkhoff/lbForth
GitHub - larsbrinkhoff/lbForth: Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Flarsbrinkhoff%2FlbForth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Flarsbrinkhoff%2FlbForth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=larsbrinkhoff%2FlbForth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[larsbrinkhoff](/larsbrinkhoff)
/
**[lbForth](/larsbrinkhoff/lbForth)**
Public
* [Notifications](/login?return_to=%2Flarsbrinkhoff%2FlbForth) You must be signed in to change notification settings
* [Fork
112](/login?return_to=%2Flarsbrinkhoff%2FlbForth)
* [Star
475](/login?return_to=%2Flarsbrinkhoff%2FlbForth)
Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
### License
[GPL-3.0 license](/larsbrinkhoff/lbForth/blob/master/LICENSE)
[475
stars](/larsbrinkhoff/lbForth/stargazers) [112
forks](/larsbrinkhoff/lbForth/forks) [Branches](/larsbrinkhoff/lbForth/branches) [Tags](/larsbrinkhoff/lbForth/tags) [Activity](/larsbrinkhoff/lbForth/activity)
[Star](/login?return_to=%2Flarsbrinkhoff%2FlbForth)
[Notifications](/login?return_to=%2Flarsbrinkhoff%2FlbForth) You must be signed in to change notification settings
* [Code](/larsbrinkhoff/lbForth)
* [Issues
40](/larsbrinkhoff/lbForth/issues)
* [Pull requests
1](/larsbrinkhoff/lbForth/pulls)
* [Actions](/larsbrinkhoff/lbForth/actions)
* [Projects
0](/larsbrinkhoff/lbForth/projects)
* [Wiki](/larsbrinkhoff/lbForth/wiki)
* [Security
0](/larsbrinkhoff/lbForth/security)
* [Insights](/larsbrinkhoff/lbForth/pulse)
Additional navigation options
* [Code](/larsbrinkhoff/lbForth)
* [Issues](/larsbrinkhoff/lbForth/issues)
* [Pull requests](/larsbrinkhoff/lbForth/pulls)
* [Actions](/larsbrinkhoff/lbForth/actions)
* [Projects](/larsbrinkhoff/lbForth/projects)
* [Wiki](/larsbrinkhoff/lbForth/wiki)
* [Security](/larsbrinkhoff/lbForth/security)
* [Insights](/larsbrinkhoff/lbForth/pulse)
# larsbrinkhoff/lbForth
master
[Branches](/larsbrinkhoff/lbForth/branches)[Tags](/larsbrinkhoff/lbForth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[815 Commits](/larsbrinkhoff/lbForth/commits/master/) 815 Commits | | |
| [contrib](/larsbrinkhoff/lbForth/tree/master/contrib "contrib") | | [contrib](/larsbrinkhoff/lbForth/tree/master/contrib "contrib") | | |
| [doc](/larsbrinkhoff/lbForth/tree/master/doc "doc") | | [doc](/larsbrinkhoff/lbForth/tree/master/doc "doc") | | |
| [experiments](/larsbrinkhoff/lbForth/tree/master/experiments "experiments") | | [experiments](/larsbrinkhoff/lbForth/tree/master/experiments "experiments") | | |
| [lib](/larsbrinkhoff/lbForth/tree/master/lib "lib") | | [lib](/larsbrinkhoff/lbForth/tree/master/lib "lib") | | |
| [lisp @ 40b99c0](/larsbrinkhoff/forth-metacompiler/tree/40b99c09628f616d94649009ba9894340088d77c "lisp") | | [lisp @ 40b99c0](/larsbrinkhoff/forth-metacompiler/tree/40b99c09628f616d94649009ba9894340088d77c "lisp") | | |
| [src](/larsbrinkhoff/lbForth/tree/master/src "src") | | [src](/larsbrinkhoff/lbForth/tree/master/src "src") | | |
| [targets](/larsbrinkhoff/lbForth/tree/master/targets "targets") | | [targets](/larsbrinkhoff/lbForth/tree/master/targets "targets") | | |
| [test](/larsbrinkhoff/lbForth/tree/master/test "test") | | [test](/larsbrinkhoff/lbForth/tree/master/test "test") | | |
| [.gdbinit](/larsbrinkhoff/lbForth/blob/master/.gdbinit ".gdbinit") | | [.gdbinit](/larsbrinkhoff/lbForth/blob/master/.gdbinit ".gdbinit") | | |
| [.gitattributes](/larsbrinkhoff/lbForth/blob/master/.gitattributes ".gitattributes") | | [.gitattributes](/larsbrinkhoff/lbForth/blob/master/.gitattributes ".gitattributes") | | |
| [.gitignore](/larsbrinkhoff/lbForth/blob/master/.gitignore ".gitignore") | | [.gitignore](/larsbrinkhoff/lbForth/blob/master/.gitignore ".gitignore") | | |
| [.gitlab-ci.yml](/larsbrinkhoff/lbForth/blob/master/.gitlab-ci.yml ".gitlab-ci.yml") | | [.gitlab-ci.yml](/larsbrinkhoff/lbForth/blob/master/.gitlab-ci.yml ".gitlab-ci.yml") | | |
| [.gitmodules](/larsbrinkhoff/lbForth/blob/master/.gitmodules ".gitmodules") | | [.gitmodules](/larsbrinkhoff/lbForth/blob/master/.gitmodules ".gitmodules") | | |
| [.scrutinizer.yml](/larsbrinkhoff/lbForth/blob/master/.scrutinizer.yml ".scrutinizer.yml") | | [.scrutinizer.yml](/larsbrinkhoff/lbForth/blob/master/.scrutinizer.yml ".scrutinizer.yml") | | |
| [.travis.yml](/larsbrinkhoff/lbForth/blob/master/.travis.yml ".travis.yml") | | [.travis.yml](/larsbrinkhoff/lbForth/blob/master/.travis.yml ".travis.yml") | | |
| [INSTALL](/larsbrinkhoff/lbForth/blob/master/INSTALL "INSTALL") | | [INSTALL](/larsbrinkhoff/lbForth/blob/master/INSTALL "INSTALL") | | |
| [LICENSE](/larsbrinkhoff/lbForth/blob/master/LICENSE "LICENSE") | | [LICENSE](/larsbrinkhoff/lbForth/blob/master/LICENSE "LICENSE") | | |
| [Makefile](/larsbrinkhoff/lbForth/blob/master/Makefile "Makefile") | | [Makefile](/larsbrinkhoff/lbForth/blob/master/Makefile "Makefile") | | |
| [PITCHME.md](/larsbrinkhoff/lbForth/blob/master/PITCHME.md "PITCHME.md") | | [PITCHME.md](/larsbrinkhoff/lbForth/blob/master/PITCHME.md "PITCHME.md") | | |
| [README.md](/larsbrinkhoff/lbForth/blob/master/README.md "README.md") | | [README.md](/larsbrinkhoff/lbForth/blob/master/README.md "README.md") | | |
| [appharbor.sln](/larsbrinkhoff/lbForth/blob/master/appharbor.sln "appharbor.sln") | | [appharbor.sln](/larsbrinkhoff/lbForth/blob/master/appharbor.sln "appharbor.sln") | | |
| [appveyor.yml](/larsbrinkhoff/lbForth/blob/master/appveyor.yml "appveyor.yml") | | [appveyor.yml](/larsbrinkhoff/lbForth/blob/master/appveyor.yml "appveyor.yml") | | |
| [bitrise.yml](/larsbrinkhoff/lbForth/blob/master/bitrise.yml "bitrise.yml") | | [bitrise.yml](/larsbrinkhoff/lbForth/blob/master/bitrise.yml "bitrise.yml") | | |
| [build.md](/larsbrinkhoff/lbForth/blob/master/build.md "build.md") | | [build.md](/larsbrinkhoff/lbForth/blob/master/build.md "build.md") | | |
| [build.vcxproj](/larsbrinkhoff/lbForth/blob/master/build.vcxproj "build.vcxproj") | | [build.vcxproj](/larsbrinkhoff/lbForth/blob/master/build.vcxproj "build.vcxproj") | | |
| [circle.yml](/larsbrinkhoff/lbForth/blob/master/circle.yml "circle.yml") | | [circle.yml](/larsbrinkhoff/lbForth/blob/master/circle.yml "circle.yml") | | |
| [configure](/larsbrinkhoff/lbForth/blob/master/configure "configure") | | [configure](/larsbrinkhoff/lbForth/blob/master/configure "configure") | | |
| [packages.config](/larsbrinkhoff/lbForth/blob/master/packages.config "packages.config") | | [packages.config](/larsbrinkhoff/lbForth/blob/master/packages.config "packages.config") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [GPL-3.0 license](#)
( Subset of Forth94 )
This is a self-hosted implementation of Forth, which can regenerate
itself from Forth source code. The bootstrapping process uses a
[metacompiler written in Lisp](https://github.com/larsbrinkhoff/forth-metacompiler) to target a
small inner interpreter and a handful of code words written in C. A
new [metacompiler written in Forth](/larsbrinkhoff/lbForth/blob/master/lib/meta.fth) generates an x86
executable using using [assembly language code words](/larsbrinkhoff/lbForth/blob/master/targets/x86/nucleus.fth).
There are also ARM, RISC-V, Motorola 68000, PDP-11, and asm.js
targets. There is a [cross
compiler](http://github.com/larsbrinkhoff/xForth) for 6502, 8051, AVR,
Cortex-M, MSP430, PDP-8, PIC, and STM8.
( Continuous integration )
The code is continuously built and tested in Linux, MacOS X, and
Windows using several cloud-based continuous integration services.
This is documented in [build.md](/larsbrinkhoff/lbForth/blob/master/build.md).
( Further reading )
[INSTALL](/larsbrinkhoff/lbForth/blob/master/INSTALL) \ How to build.
[doc](/larsbrinkhoff/lbForth/blob/master/doc) \ Classic (and recent) texts not related to this project.
[lib/README](/larsbrinkhoff/lbForth/blob/master/lib/README) \ Information about libraries.
[targets/README.md](/larsbrinkhoff/lbForth/blob/master/targets/README.md) \ Information about current and possibly future targets.
( Implementation guide )
The Forth kernel contains everything needed to read and compile the
rest of the system from source code, and not much else. It's composed
of two parts: a target-specific file nucleus.fth containing all
primitive CODE words, and a [target-independent
kernel.fth](/larsbrinkhoff/lbForth/blob/master/src/kernel.fth). These two are compiled by the
metacompiler.
The [C target nucleus](/larsbrinkhoff/lbForth/blob/master/targets/c/nucleus.fth) used for bootstrapping
has only twelve proper primitives. There is also the COLD word which
compiles to main(), and four I/O words.
When the kernel starts, it jumps to the word called WARM. This is
responsible for loading the rest of the system and entering the text
interpreter. The first file loaded by WARM is [core.fth](/larsbrinkhoff/lbForth/blob/master/src/core.fth),
which implements the CORE wordset. Because the kernel only has a bare
minimum of words, the start of core.fth looks a little strange.
## About
Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
### Topics
[linux](/topics/linux "Topic: linux")
[programming-language](/topics/programming-language "Topic: programming-language")
[avr](/topics/avr "Topic: avr")
[arm](/topics/arm "Topic: arm")
[interpreter](/topics/interpreter "Topic: interpreter")
[cortex-m](/topics/cortex-m "Topic: cortex-m")
[compiler](/topics/compiler "Topic: compiler")
[self-hosted](/topics/self-hosted "Topic: self-hosted")
[riscv](/topics/riscv "Topic: riscv")
[forth](/topics/forth "Topic: forth")
[x86](/topics/x86 "Topic: x86")
[msp430](/topics/msp430 "Topic: msp430")
[pdp11](/topics/pdp11 "Topic: pdp11")
[metacompiler](/topics/metacompiler "Topic: metacompiler")
[m68k](/topics/m68k "Topic: m68k")
[asmjs](/topics/asmjs "Topic: asmjs")
[6502](/topics/6502 "Topic: 6502")
[risc-v](/topics/risc-v "Topic: risc-v")
[8051](/topics/8051 "Topic: 8051")
### Resources
[Readme](#readme-ov-file)
### License
[GPL-3.0 license](#GPL-3.0-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/larsbrinkhoff/lbForth/activity)
### Stars
[**475**
stars](/larsbrinkhoff/lbForth/stargazers)
### Watchers
[**29**
watching](/larsbrinkhoff/lbForth/watchers)
### Forks
[**112**
forks](/larsbrinkhoff/lbForth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Flarsbrinkhoff%2FlbForth&report=larsbrinkhoff+%28user%29)
## [Releases](/larsbrinkhoff/lbForth/releases)
No releases published
## [Packages 0](/users/larsbrinkhoff/packages?repo_name=lbForth)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## [Contributors 4](/larsbrinkhoff/lbForth/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [Forth
96.7%](/larsbrinkhoff/lbForth/search?l=forth)
* [Makefile
1.0%](/larsbrinkhoff/lbForth/search?l=makefile)
* [Emacs Lisp
0.8%](/larsbrinkhoff/lbForth/search?l=emacs-lisp)
* [Shell
0.7%](/larsbrinkhoff/lbForth/search?l=shell)
* [C
0.4%](/larsbrinkhoff/lbForth/search?l=c)
* [HTML
0.2%](/larsbrinkhoff/lbForth/search?l=html)
* Other
0.2%
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,434 @@
# luaforth
**Source:** https://github.com/vifino/luaforth
GitHub - vifino/luaforth: A simple Forth in Lua for embedded usage.
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fvifino%2Fluaforth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fvifino%2Fluaforth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=vifino%2Fluaforth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[vifino](/vifino)
/
**[luaforth](/vifino/luaforth)**
Public
* [Notifications](/login?return_to=%2Fvifino%2Fluaforth) You must be signed in to change notification settings
* [Fork
2](/login?return_to=%2Fvifino%2Fluaforth)
* [Star
6](/login?return_to=%2Fvifino%2Fluaforth)
A simple Forth in Lua for embedded usage.
### License
[MIT license](/vifino/luaforth/blob/master/LICENSE)
[6
stars](/vifino/luaforth/stargazers) [2
forks](/vifino/luaforth/forks) [Branches](/vifino/luaforth/branches) [Tags](/vifino/luaforth/tags) [Activity](/vifino/luaforth/activity)
[Star](/login?return_to=%2Fvifino%2Fluaforth)
[Notifications](/login?return_to=%2Fvifino%2Fluaforth) You must be signed in to change notification settings
* [Code](/vifino/luaforth)
* [Issues
0](/vifino/luaforth/issues)
* [Pull requests
0](/vifino/luaforth/pulls)
* [Actions](/vifino/luaforth/actions)
* [Projects
0](/vifino/luaforth/projects)
* [Security
0](/vifino/luaforth/security)
* [Insights](/vifino/luaforth/pulse)
Additional navigation options
* [Code](/vifino/luaforth)
* [Issues](/vifino/luaforth/issues)
* [Pull requests](/vifino/luaforth/pulls)
* [Actions](/vifino/luaforth/actions)
* [Projects](/vifino/luaforth/projects)
* [Security](/vifino/luaforth/security)
* [Insights](/vifino/luaforth/pulse)
# vifino/luaforth
master
[Branches](/vifino/luaforth/branches)[Tags](/vifino/luaforth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[27 Commits](/vifino/luaforth/commits/master/) 27 Commits | | |
| [bin](/vifino/luaforth/tree/master/bin "bin") | | [bin](/vifino/luaforth/tree/master/bin "bin") | | |
| [tests](/vifino/luaforth/tree/master/tests "tests") | | [tests](/vifino/luaforth/tree/master/tests "tests") | | |
| [.travis.yml](/vifino/luaforth/blob/master/.travis.yml ".travis.yml") | | [.travis.yml](/vifino/luaforth/blob/master/.travis.yml ".travis.yml") | | |
| [LICENSE](/vifino/luaforth/blob/master/LICENSE "LICENSE") | | [LICENSE](/vifino/luaforth/blob/master/LICENSE "LICENSE") | | |
| [Makefile](/vifino/luaforth/blob/master/Makefile "Makefile") | | [Makefile](/vifino/luaforth/blob/master/Makefile "Makefile") | | |
| [README.md](/vifino/luaforth/blob/master/README.md "README.md") | | [README.md](/vifino/luaforth/blob/master/README.md "README.md") | | |
| [app.lua](/vifino/luaforth/blob/master/app.lua "app.lua") | | [app.lua](/vifino/luaforth/blob/master/app.lua "app.lua") | | |
| [auto-run-tests-on-change.sh](/vifino/luaforth/blob/master/auto-run-tests-on-change.sh "auto-run-tests-on-change.sh") | | [auto-run-tests-on-change.sh](/vifino/luaforth/blob/master/auto-run-tests-on-change.sh "auto-run-tests-on-change.sh") | | |
| [luaforth.lua](/vifino/luaforth/blob/master/luaforth.lua "luaforth.lua") | | [luaforth.lua](/vifino/luaforth/blob/master/luaforth.lua "luaforth.lua") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [MIT license](#)
# luaforth
[![Build Status](https://camo.githubusercontent.com/f84f1765e4dc206c95e842195c97624b2fc6309edb929d618d902c914ae3de0e/68747470733a2f2f7472617669732d63692e6f72672f766966696e6f2f6c7561666f7274682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vifino/luaforth) [![Coverage Status](https://camo.githubusercontent.com/92a923f80497d3e929dddec4c3199009e5b54f47d881a20b0aad9e406593c60b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f766966696e6f2f6c7561666f7274682f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/vifino/luaforth?branch=master)
A simplistic and decently fast base implementation of a Forth parser.
If you expect a fully featured forth here, you're wrong.
This is made for people who want to embed a Forth-like into their project.
# Usage
1. `require`/load luaforth.
2. Create an environment.
3. Call `new_stack, new_environment = luaforth.eval(program_source, environment[, stack, program_source_start_position])`.
Tada!
# Example
See `luaforth.simple_env` [here](https://github.com/vifino/luaforth/blob/master/luaforth.lua#L246-L253) or below.
```
-- Example env that has %L to evaluate the line and [L L] pairs to evaluate a small block of Lua code.
local simple_env = {
["%L"] = {
_fn=function(stack, env, str)
local f, err = loadstring("return " .. str)
if err then
f, err = loadstring(str)
if err then
error(err, 0)
end
end
return f()
end,
_parse = "line"
},
["[L"] = {
_fn=function(stack, env, str)
local f, err = loadstring("return " .. str)
if err then
f, err = loadstring(str)
if err then
error(err, 0)
end
end
return f()
end,
_parse = "endsign",
_endsign = "L]"
}
}
-- Function creation.
luaforth.simple_env[":"] = {
_fn = function(stack, env, fn)
local nme, prg = string.match(fn, "^(.-) (.-)$")
luaforth.simple_env[nme] = {
_fn = function(stack, env)
return luaforth.eval(prg, env, stack)
end,
_fnret = "newstack"
}
end,
_parse = "endsign",
_endsign = ";"
}
```
# Environment
Contains words, strings, booleans, numbers and other things that the forth instance will be able to use.
## Word Structure
Words are Forth jargon for functions.
Look here or below to see how they are structured in this implementation.
```
-- Word structure:
-- env[name] = {
-- _fn = func -- function that runs the logic
-- _fnret = ["pushtostack", "newstack"] -- wether the function's return values should be added to the stack or _be_ the stack. Defaults to pushtostack.
-- _args = n -- number of arguments which are pop'd from the stack, defaults to 0
-- _parse = ["line"|"word"|"endsign"|"pattern"] -- optional advanced parsing, line passes the whole line to the word, word only the next word, pattern parses given pattern, endsign until...
-- _endsign = string -- the given endsign appears.
-- _pattern = pattern -- pattern for parse option
-- }
```
# License
MIT
## About
A simple Forth in Lua for embedded usage.
### Topics
[lua-library](/topics/lua-library "Topic: lua-library")
[lua](/topics/lua "Topic: lua")
[forth](/topics/forth "Topic: forth")
### Resources
[Readme](#readme-ov-file)
### License
[MIT license](#MIT-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/vifino/luaforth/activity)
### Stars
[**6**
stars](/vifino/luaforth/stargazers)
### Watchers
[**2**
watching](/vifino/luaforth/watchers)
### Forks
[**2**
forks](/vifino/luaforth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fvifino%2Fluaforth&report=vifino+%28user%29)
## [Releases](/vifino/luaforth/releases)
No releases published
## [Packages 0](/users/vifino/packages?repo_name=luaforth)
No packages published
## [Contributors 2](/vifino/luaforth/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [Lua
95.7%](/vifino/luaforth/search?l=lua)
* [Forth
3.0%](/vifino/luaforth/search?l=forth)
* Other
1.3%
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,199 @@
# meow5
**Source:** https://ratfactor.com/meow5/
Meow5: An Extremely Concatenative Programming Language - ratfactor
[![vector ratfactor rat logo](/images/rat-logo.svg)](/)
[Home](/) |
[About](/about/) |
[Now](/now) |
[Repos](/repos/) |
[Cards](/cards/) |
[Contact](/contact-me/) |
[RSS![rss feed icon](/images/rss.svg)](/atom.xml)
# Meow5: An Extremely Concatenative Programming Language
Created: 2022-11-10
Updated: 2023-11-21
![meow5 kitty logo is black with two bright teal eyes and a pink nose](meow5.png)
**Update 2023-11-21:** Meow5 is done! [Read my conclusion here!](done)
Meow5 is a ["concatenative"](https://en.wikipedia.org/wiki/Concatenative_programming_language) (wikipedia.org)
programming language. I also consider it to be a "Forth-like" language since it follows the same
stack-based value passing method and borrows some of Forths syntax and nomenclature.
Hello world (in cat):
```
"Meow!" print
Meow!
```
* **The Repo:** [Meow5 Repo](/repos/meow5/)
* **Read more:** [Assembly Nights "Season 2"](../assembly-nights2)
might explain why I would do something like this
**Update 2023-11-01:** Well, would you look at that? Its just shy of a year after I started
this and I think Im actually going to be able to finish [it](done) quite soon.
(To see where Im currently at, scroll down to **Current progress** below.)
Its unique feature is its "inline all the things!" compiling method. A Meow5 function is
the recursively concatenated machine code of every function it calls. At the bottom are "primitive" functions
written in assembly language, which is where the machine code comes from.
Wait, you mean every time I call a function in another function, Im making a complete copy of that
function, which is a complete copy of every function *that* function calls, all the way down?
Yup! Pretty nuts, right? Feel free to run away from this page screaming now.
But when a primitive is just a dozen bytes long, you can make quite a few
copies of it before its a problem. Im very curious to see how it benchmarks
against other languages in various ways: size, speed, cuteness.
## Syntax
Meow5 borrows heavily from the ur-language **Forth**, which was delivered to our dimension by the
prophet Charles H. Moore in the late 1960s.
Creating a new function, `meow`, that prints the string "Meow" looks like this:
```
: meow "Meow." print ;
```
Creating a another function, `meow5`, which executes `meow` five times:
```
: meow5 meow meow meow meow meow ;
```
Invoke their names to call these functions:
```
meow
Meow.
meow5
Meow.Meow.Meow.Meow.Meow.
```
Thats a lot of meows! Whos a hungry kitty?
To drive home an earlier point: the above `meow5` function doesnt just *call* `meow` five times, it actually *contains* five consecutive copies of `meow`!
## Current Progress
Heres a list of milestones reached. The log text file references are from my
devlog files which I write as Im creating Meow5. You can find them in the repo!
(Note to self, when I put the logs up here like I did for [nasmjf](../nasmjf/), link these!)
* (log01.txt) Executing a *copy* of the machine code to print "Meow" at runtime
* (log01.txt) Programatically inlining multiple copies of the "Meow" printer
* (log02.txt) Added function "tail" metadata for linked list dictionary, to use Forth terminology
* (log02.txt) Added `find` function to lookup functions by name for inlining
* (log03.txt) Figured out how to call these machine code chunks so they can return to the call site
* (log03.txt) Have interpreter parsing tokens from a hard-coded input string and executing them
* (log04.txt) Have COMPILE vs IMMEDIATE modes and functions may opt-in for either
* (log05.txt) Using NASM macros to inline functions at the assembly level to build interpreter
* (log05.txt) **Major:** Finished `:` ("colon") and `;` ("semicolon") for function definitions!
* (log06.txt) Added string literals to the language can do this: `"Meow!" print`
* (log06.txt) Have string literals working in *compiled* functions!
* (log06.txt) DEBUG printing (can be inserted anywhere in the assembly)
* (log06.txt) **Major:** The canonical `meow5` function works as shown on this page!
* (log07.txt) Added `str2num` and `num2str` for numeric input/output
* (log07.txt) Have numeric interpolation in strings with `$` placeholders
* (log07.txt) Have string escape sequences (e.g. `\n`)
* (log07.txt) Functions 'inspect' and 'inspect\_all' print all functions with size in bytes
* (log08.txt) **Major:** Reading interpreter input from STDIN!
**TODO:** The above are badly in need of updating and links.
**Update 2023-11-01:** Ive finished the [mez](/repos/mez/) tools in Zig to
help me understand, create, and debug ELF executables and feel fully capable
of finishing the ELF output of Meow5. Lets do this! Also: "failed art project" below
was waaay too harsh. Its going to be a successful art project!
**Update 2023-10-17:** Five months later, Im back. I essentially consider
this to be a failed art project, but I am not willing to let it rest until
it compiles an ELF executable that prints "Meow" five times!
```
>o.o< --"Why yes, I do speak ASCII!"
```
## Technical Details
**32-bit x86 Linux:** Meow5 is written with the NASM assembler (<https://nasm.us/>) and targets the
32-bit i386 (x86) architecture. It makes direct Linux syscalls and uses no external
libraries. Portability is not a goal.
**Stack-oriented:** Meow5 uses the i386 `PUSH` and `POP` instructions in the normal fashion to set/get items
from the stack (a region of memory to which items are added or removed sequentially in
a "first in, last out" fashion). One thing thats neat about this is that alleviates the difficult task of putting
names to data. It also generally produces compact and uncluttered syntax.
<https://en.wikipedia.org/wiki/Stack-oriented_programming>
**Just in Time Compiled:** The moment you start compiling a new function `foo`, its machine code is being
inlined into memory. When you execute `foo`, a `JMP` instruction is issued to its machine code, which then
runs until it hits a chunk of "return code" inlined at the end of the definition, which jumps back to the
call site. It does not use `CALL` and `RET` and there can be only *one* level of direct function call
in this fashion, which, it turns out, is all you need for an interactive Meow5 interpreter.
**Inline All the Things!:** If you use function `foo` in the definition of a new function `bar`, the machine
code of `foo` (not including the "return code" mentioned above or the "tail" with function metadata) is
inlined into `bar`.
The logical conclusion is that a Meow5 **program** is a top-level function containing a continuous
stream of concatenated machine code. What I would like to do at some point is write out such a program
with an ELF header and see if I can make stand-alone Linux executables!
## OpenBSD
I was really curious what OpenBSD would think of this since my understanding is that it
has [W^X (wrote xor execute)](https://en.wikipedia.org/wiki/W%5EX) by default.
Sure enough, even the linker catches this:
```
ld: error: can't create dynamic relocation R_386_32 against local symbol in
readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext'
to allow text relocations in the output
>>> defined in meow5.o
>>> referenced by meow5.asm:167
>>> meow5.o:(tail_strlen)
```
which is in reference to:
```
%macro ENDWORD 3
...
tail_%1:
dd LAST_WORD_TAIL ; <---- this line
```
Where Im putting the address of the previous function in the tail of the
current one to make a linked list.
Im not sure what those two suggested options are. I might try them to see how far I get.
---
I made the SVG Meow5 logo in Inkscape 0.92. It uses the **Sazanami Mincho**
font by Yasuyuki Furukawa.
*Mincho* evidently means something very similar to what 'serif' means in Latin typefaces.
See [Ming typefaces](https://en.wikipedia.org/wiki/Ming_(typefaces)) (wikipedia.org).
This page was last generated 2023-11-21 15:13:54 -0500
All content © Copyright Dave Gauer

View File

@@ -0,0 +1,398 @@
# milliForth
**Source:** https://github.com/fuzzballcat/milliForth
GitHub - fuzzballcat/milliForth: A FORTH in 340 bytes — the smallest real programming language ever as of yet.
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Ffuzzballcat%2FmilliForth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Ffuzzballcat%2FmilliForth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=fuzzballcat%2FmilliForth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[fuzzballcat](/fuzzballcat)
/
**[milliForth](/fuzzballcat/milliForth)**
Public
* [Notifications](/login?return_to=%2Ffuzzballcat%2FmilliForth) You must be signed in to change notification settings
* [Fork
28](/login?return_to=%2Ffuzzballcat%2FmilliForth)
* [Star
623](/login?return_to=%2Ffuzzballcat%2FmilliForth)
A FORTH in 340 bytes — the smallest real programming language ever as of yet.
### License
[MIT license](/fuzzballcat/milliForth/blob/master/LICENSE)
[623
stars](/fuzzballcat/milliForth/stargazers) [28
forks](/fuzzballcat/milliForth/forks) [Branches](/fuzzballcat/milliForth/branches) [Tags](/fuzzballcat/milliForth/tags) [Activity](/fuzzballcat/milliForth/activity)
[Star](/login?return_to=%2Ffuzzballcat%2FmilliForth)
[Notifications](/login?return_to=%2Ffuzzballcat%2FmilliForth) You must be signed in to change notification settings
* [Code](/fuzzballcat/milliForth)
* [Issues
6](/fuzzballcat/milliForth/issues)
* [Pull requests
1](/fuzzballcat/milliForth/pulls)
* [Actions](/fuzzballcat/milliForth/actions)
* [Projects
0](/fuzzballcat/milliForth/projects)
* [Security
0](/fuzzballcat/milliForth/security)
* [Insights](/fuzzballcat/milliForth/pulse)
Additional navigation options
* [Code](/fuzzballcat/milliForth)
* [Issues](/fuzzballcat/milliForth/issues)
* [Pull requests](/fuzzballcat/milliForth/pulls)
* [Actions](/fuzzballcat/milliForth/actions)
* [Projects](/fuzzballcat/milliForth/projects)
* [Security](/fuzzballcat/milliForth/security)
* [Insights](/fuzzballcat/milliForth/pulse)
# fuzzballcat/milliForth
master
[Branches](/fuzzballcat/milliForth/branches)[Tags](/fuzzballcat/milliForth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[42 Commits](/fuzzballcat/milliForth/commits/master/) 42 Commits | | |
| [.gitignore](/fuzzballcat/milliForth/blob/master/.gitignore ".gitignore") | | [.gitignore](/fuzzballcat/milliForth/blob/master/.gitignore ".gitignore") | | |
| [LICENSE](/fuzzballcat/milliForth/blob/master/LICENSE "LICENSE") | | [LICENSE](/fuzzballcat/milliForth/blob/master/LICENSE "LICENSE") | | |
| [README.md](/fuzzballcat/milliForth/blob/master/README.md "README.md") | | [README.md](/fuzzballcat/milliForth/blob/master/README.md "README.md") | | |
| [bf.FORTH](/fuzzballcat/milliForth/blob/master/bf.FORTH "bf.FORTH") | | [bf.FORTH](/fuzzballcat/milliForth/blob/master/bf.FORTH "bf.FORTH") | | |
| [hello\_world.FORTH](/fuzzballcat/milliForth/blob/master/hello_world.FORTH "hello_world.FORTH") | | [hello\_world.FORTH](/fuzzballcat/milliForth/blob/master/hello_world.FORTH "hello_world.FORTH") | | |
| [makefile](/fuzzballcat/milliForth/blob/master/makefile "makefile") | | [makefile](/fuzzballcat/milliForth/blob/master/makefile "makefile") | | |
| [py\_autotype.py](/fuzzballcat/milliForth/blob/master/py_autotype.py "py_autotype.py") | | [py\_autotype.py](/fuzzballcat/milliForth/blob/master/py_autotype.py "py_autotype.py") | | |
| [sector.asm](/fuzzballcat/milliForth/blob/master/sector.asm "sector.asm") | | [sector.asm](/fuzzballcat/milliForth/blob/master/sector.asm "sector.asm") | | |
| [sector.bin](/fuzzballcat/milliForth/blob/master/sector.bin "sector.bin") | | [sector.bin](/fuzzballcat/milliForth/blob/master/sector.bin "sector.bin") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [MIT license](#)
# milliForth
A FORTH in 336 bytes — the smallest real programming language ever, as of yet.
[![milliFORTH_justhelloworld](https://private-user-images.githubusercontent.com/57006511/280563430-ef3d48cf-1581-4574-8625-8d97b00acaca.gif?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE1MzU2MzMsIm5iZiI6MTc3MTUzNTMzMywicGF0aCI6Ii81NzAwNjUxMS8yODA1NjM0MzAtZWYzZDQ4Y2YtMTU4MS00NTc0LTg2MjUtOGQ5N2IwMGFjYWNhLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjE5VDIxMDg1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcxNDY0NDE3Y2Y5ZDJlNzZjODJmMzg3Y2UxOTc0YzZkMmRkNTAxYzlhNjlmMzY0M2QwNTI1ZmFlNWZmN2I3MzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.i685Rg4zicP8T5zIc3OkurV6p1baueZnnnr_PEWah3c)](https://private-user-images.githubusercontent.com/57006511/280563430-ef3d48cf-1581-4574-8625-8d97b00acaca.gif?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE1MzU2MzMsIm5iZiI6MTc3MTUzNTMzMywicGF0aCI6Ii81NzAwNjUxMS8yODA1NjM0MzAtZWYzZDQ4Y2YtMTU4MS00NTc0LTg2MjUtOGQ5N2IwMGFjYWNhLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjE5VDIxMDg1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcxNDY0NDE3Y2Y5ZDJlNzZjODJmMzg3Y2UxOTc0YzZkMmRkNTAxYzlhNjlmMzY0M2QwNTI1ZmFlNWZmN2I3MzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.i685Rg4zicP8T5zIc3OkurV6p1baueZnnnr_PEWah3c)
*The code in the above gif, that of [an older version of] `hello_world.FORTH`, is a modified version of the hello world program used by sectorFORTH (see below)*
## bytes?
Yes, bytes. This is a FORTH so small it fits in a 512-byte boot sector. This isn't new — sectorFORTH[1](#user-content-fn-1-d37e1f81f2eea8c6e7bde869760db32c) successfully fit a FORTH within the boot sector. However, milliFORTH appears to be *the smallest* "real" programming language implementation ever, beating out sectorLISP[2](#user-content-fn-2-d37e1f81f2eea8c6e7bde869760db32c), a mind-blowing 436 byte implementation of LISP, by 96 bytes. ("real" excludes esolangs and other non-production languages - for example, the sectorLISP author's implementation of BF is just 99 bytes, but it clearly isn't used to any serious capacity.) It's now even smaller thanks to some really neat suggestions!
## Is it turing-complete?
Yes! This project now includes `bf.FORTH`, a compliant brainfuck interpreter, to illlustrate that this is truly a real language.
## Language
sectorFORTH[1](#user-content-fn-1-d37e1f81f2eea8c6e7bde869760db32c) was an extensive guide throughout the process of implementing milliFORTH, and milliFORTH's design actually converged on sectorFORTH unintentionally in a few areas. That said, the language implemented is intentionally very similar, being the 'minimal FORTH'.
FORTH itself will not be explained here (prior understanding assumed). Being so small, milliFORTH contains just a handful of words:
| Word | Signature | Function |
| --- | --- | --- |
| `@` | `( addr -- value )` | Get a value at an address |
| `!` | `( value addr -- )` | Store a value at an address |
| `sp@` | `( -- sp )` | Get pointer to top of the data stack |
| `rp@` | `( -- rp )` | Get pointer to top of the return stack |
| `0#` | `( value -- flag )` | Check if a value does not equal zero (-1 = TRUE, 0 = FALSE) |
| `+` | `( a b -- a+b )` | Sum two numbers |
| `nand` | `( a b -- aNANDb )` | NAND two numbers |
| `exit` | `( r:addr -- )` | Pop from the return stack, resume execution at the popped address |
| `key` | `( -- key )` | Read a keystroke |
| `emit` | `( char -- )` | Print out an ASCII character |
| `s@` | `( -- s@ )` | The "state struct" pointer. The cells of this struct are, in order: * `state`: The state of the interpreter (0 = compile words, 1 = execute words) * `>in`: Pointer to the current offset into the terminal input buffer * `latest`: The pointer to the most recent dictionary space * `here`: The pointer to the next available space in the dictionary |
On a fundamental level, milliFORTH the same FORTH as implemented by sectorFORTH, with a few modifications:
* All of the interpreter state words are bundled into a single struct (`s@`).
* Words don't get hidden while you are defining them. This doesn't really hinder your actual ability to write programs, but rather makes it possible to hang the interpreter if you do something wrong in this respect.
* There's no `tib` (terminal input buffer) word, because `tib` always starts at `0x0000`, so you can just use `>in` and don't need to add anything to it.
* In the small (production) version, the delete key doesn't work. I think this is fair since sectorLISP doesn't handle backspace either; even if you add it back, milliFORTH is still smaller by a few bytes.
* Error handling is even sparser. Successful input results in nothing (no familiar `ok.`). Erroneous input prints an extra blank line between the previous input and the next prompt.
## Use
sector.bin is an assembled binary of sector.asm. You can run it using `make emulate`, which invokes (and thus requires) `qemu-system-i386`, or by using any emulator of your choice.
Alternatively, `make` will reassemble sector.asm, then run the above qemu emulator.
Additionally, you can run an example file easily by running `make runfile file=SOURCE_CODE`. Try out `make runfile file=hello_world.FORTH` or `make runfile file=bf.FORTH`! *NOTE: Files run this way currently do not accept user input from stdin, as the file itself is being piped to qemu. Fix coming shortly.*
`make sizecheck` is a utility which assembles sector.asm into sector.bin and then lists out the size of sector.bin for you. Note that this automatically removes the padding from the .bin (as a working bootloader must be exactly 512 bytes).
## References
## Footnotes
1. The immensely inspirational sectorForth, to which much credit is due: <https://github.com/cesarblum/sectorforth/>. [](#user-content-fnref-1-d37e1f81f2eea8c6e7bde869760db32c) [↩2](#user-content-fnref-1-2-d37e1f81f2eea8c6e7bde869760db32c)
2. Mind-blowing sectorLISP: <https://justine.lol/sectorlisp2/>, <https://github.com/jart/sectorlisp>. [](#user-content-fnref-2-d37e1f81f2eea8c6e7bde869760db32c)
## About
A FORTH in 340 bytes — the smallest real programming language ever as of yet.
### Resources
[Readme](#readme-ov-file)
### License
[MIT license](#MIT-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/fuzzballcat/milliForth/activity)
### Stars
[**623**
stars](/fuzzballcat/milliForth/stargazers)
### Watchers
[**10**
watching](/fuzzballcat/milliForth/watchers)
### Forks
[**28**
forks](/fuzzballcat/milliForth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Ffuzzballcat%2FmilliForth&report=fuzzballcat+%28user%29)
## [Releases](/fuzzballcat/milliForth/releases)
No releases published
## [Packages 0](/users/fuzzballcat/packages?repo_name=milliForth)
No packages published
## [Contributors 2](/fuzzballcat/milliForth/graphs/contributors)
* [![@fuzzballcat](https://avatars.githubusercontent.com/u/57006511?s=64&v=4)](https://github.com/fuzzballcat)
[**fuzzballcat**](https://github.com/fuzzballcat)
* [![@peterferrie](https://avatars.githubusercontent.com/u/7152307?s=64&v=4)](https://github.com/peterferrie)
[**peterferrie**
Peter Ferrie](https://github.com/peterferrie)
## Languages
* [Forth
53.5%](/fuzzballcat/milliForth/search?l=forth)
* [Assembly
34.9%](/fuzzballcat/milliForth/search?l=assembly)
* [Makefile
6.8%](/fuzzballcat/milliForth/search?l=makefile)
* [Python
4.8%](/fuzzballcat/milliForth/search?l=python)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,543 @@
# pforth
**Source:** https://github.com/philburk/pforth
GitHub - philburk/pforth: Portable Forth in C
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fphilburk%2Fpforth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fphilburk%2Fpforth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=philburk%2Fpforth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[philburk](/philburk)
/
**[pforth](/philburk/pforth)**
Public
* [Notifications](/login?return_to=%2Fphilburk%2Fpforth) You must be signed in to change notification settings
* [Fork
114](/login?return_to=%2Fphilburk%2Fpforth)
* [Star
684](/login?return_to=%2Fphilburk%2Fpforth)
Portable Forth in C
### License
[0BSD license](/philburk/pforth/blob/master/license.txt)
[684
stars](/philburk/pforth/stargazers) [114
forks](/philburk/pforth/forks) [Branches](/philburk/pforth/branches) [Tags](/philburk/pforth/tags) [Activity](/philburk/pforth/activity)
[Star](/login?return_to=%2Fphilburk%2Fpforth)
[Notifications](/login?return_to=%2Fphilburk%2Fpforth) You must be signed in to change notification settings
* [Code](/philburk/pforth)
* [Issues
26](/philburk/pforth/issues)
* [Pull requests
5](/philburk/pforth/pulls)
* [Discussions](/philburk/pforth/discussions)
* [Actions](/philburk/pforth/actions)
* [Projects
0](/philburk/pforth/projects)
* [Wiki](/philburk/pforth/wiki)
* [Security
0](/philburk/pforth/security)
* [Insights](/philburk/pforth/pulse)
Additional navigation options
* [Code](/philburk/pforth)
* [Issues](/philburk/pforth/issues)
* [Pull requests](/philburk/pforth/pulls)
* [Discussions](/philburk/pforth/discussions)
* [Actions](/philburk/pforth/actions)
* [Projects](/philburk/pforth/projects)
* [Wiki](/philburk/pforth/wiki)
* [Security](/philburk/pforth/security)
* [Insights](/philburk/pforth/pulse)
# philburk/pforth
master
[Branches](/philburk/pforth/branches)[Tags](/philburk/pforth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[219 Commits](/philburk/pforth/commits/master/) 219 Commits | | |
| [.github/workflows](/philburk/pforth/tree/master/.github/workflows "This path skips through empty directories") | | [.github/workflows](/philburk/pforth/tree/master/.github/workflows "This path skips through empty directories") | | |
| [csrc](/philburk/pforth/tree/master/csrc "csrc") | | [csrc](/philburk/pforth/tree/master/csrc "csrc") | | |
| [fth](/philburk/pforth/tree/master/fth "fth") | | [fth](/philburk/pforth/tree/master/fth "fth") | | |
| [platforms](/philburk/pforth/tree/master/platforms "platforms") | | [platforms](/philburk/pforth/tree/master/platforms "platforms") | | |
| [.gitattributes](/philburk/pforth/blob/master/.gitattributes ".gitattributes") | | [.gitattributes](/philburk/pforth/blob/master/.gitattributes ".gitattributes") | | |
| [.gitignore](/philburk/pforth/blob/master/.gitignore ".gitignore") | | [.gitignore](/philburk/pforth/blob/master/.gitignore ".gitignore") | | |
| [.travis.yml](/philburk/pforth/blob/master/.travis.yml ".travis.yml") | | [.travis.yml](/philburk/pforth/blob/master/.travis.yml ".travis.yml") | | |
| [CMakeLists.txt](/philburk/pforth/blob/master/CMakeLists.txt "CMakeLists.txt") | | [CMakeLists.txt](/philburk/pforth/blob/master/CMakeLists.txt "CMakeLists.txt") | | |
| [README.md](/philburk/pforth/blob/master/README.md "README.md") | | [README.md](/philburk/pforth/blob/master/README.md "README.md") | | |
| [RELEASES.md](/philburk/pforth/blob/master/RELEASES.md "RELEASES.md") | | [RELEASES.md](/philburk/pforth/blob/master/RELEASES.md "RELEASES.md") | | |
| [license.txt](/philburk/pforth/blob/master/license.txt "license.txt") | | [license.txt](/philburk/pforth/blob/master/license.txt "license.txt") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [License](#)
# PForth - a Portable ANS-like Forth written in ANSI 'C'
by Phil Burk
with Larry Polansky, David Rosenboom and Darren Gibbs.
Support for 64-bit cells by Aleksej Saushev.
Portable Forth written in 'C' for most 32 and 64-bit platforms.
PForth is written in 'C' and can be easily ported to new 32 and 64-bit platforms.
It only needs character input and output functions to operate and, therefore, does not require an operating system.
This makes it handy for bringing up and testing embedded systems.
PForth also works on desktops including Windows, Mac and Linux and supports command line history.
This lets you develop hardware tests on a desktop before trying them on your embedded system.
But pForth is not a rich and friendly desktop programming environment.
There are no GUI tools for developing desktop applications. PForth is lean and mean and optimized for portability.
PForth has a tool for compiling code on a desktop, then exporting the dictionary in big or little endian format as 'C' source code.
This lets you compile tests for an embedded system that does not have file I/O.
PForth is based on ANSI-Forth but is not 100% compatible. <https://forth-standard.org/standard/words>
Code for pForth is maintained on GitHub at: <https://github.com/philburk/pforth>
Documentation for pForth at: <http://www.softsynth.com/pforth/>
To report bugs or request features please file a GitHub Issue.
For questions or general discussion please use the pForth forum at:
<http://groups.google.com/group/pforthdev>
## LEGAL NOTICE
Permission to use, copy, modify, and/or distribute this
software for any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
## Contents of SDK
```
platforms - tools for building pForth on various platforms
platforms/unix - Makefile for unix
csrc - pForth kernel in ANSI 'C'
csrc/pf_main.c - main() application for a standalone Forth
csrc/stdio - I/O code using basic stdio for generic platforms
csrc/posix - I/O code for Posix platform
csrc/win32 - I/O code for basic WIN32 platform
csrc/win32_console - I/O code for WIN32 console that supports command line history
fth - Forth code
fth/util - utility functions
```
## How to Build pForth
Building pForth involves two steps:
1. building the C based Forth kernel
2. building the Forth dictionary file using: ./pforth -i system.fth
3. optional build of standalone executable with built-in dictionary
We have provided build scripts to simplify this process.
On Unix and MacOS using Makefile:
```
cd platforms/unix
make all
./pforth_standalone
```
For more details, see the [Wiki](https://github.com/philburk/pforth/wiki/Compiling-on-Unix)
Please note that this can help with other platforms as well, see platforms/zig-crossbuild/ for an example.
Using CMake:
```
cmake .
make
cd fth
./pforth_standalone
```
For embedded systems, see the pForth reference manual at:
<http://www.softsynth.com/pforth/pf_ref.php>
## How to Run pForth
To run the all-in-one pForth enter:
```
./pforth_standalone
```
OR, to run using the dictionary file, enter:
```
./pforth
```
Quick check of Forth:
```
3 4 + .
words
bye
```
To compile source code files use:
```
INCLUDE filename
```
To create a custom dictionary enter in pForth:
```
c" newfilename.dic" SAVE-FORTH
```
The name must end in ".dic".
To run PForth with the new dictionary enter in the shell:
```
pforth -dnewfilename.dic
```
To run PForth and automatically include a forth file:
pforth myprogram.fth
## How to Test pForth
PForth comes with a small test suite. To test the Core words,
you can use the coretest developed by John Hayes.
On Unix and MacOS using Makefile:
```
cd platforms/unix
make test
```
Using CMake:
```
cmake .
make
cd fth
./pforth
include tester.fth
include coretest.fth
```
To run the other tests, enter:
```
pforth t_corex.fth
pforth t_strings.fth
pforth t_locals.fth
pforth t_alloc.fth
```
They will report the number of tests that pass or fail.
You can also test pForth kernel without loading a dictionary using option "-i".
Only the primitive words defined in C will be available.
This might be necessary if the dictionary can't be built.
```
./pforth -i
3 4 + .
23 77 swap .s
loadsys
```
## About
Portable Forth in C
### Topics
[c](/topics/c "Topic: c")
[forth](/topics/forth "Topic: forth")
### Resources
[Readme](#readme-ov-file)
### License
[0BSD license](#0BSD-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/philburk/pforth/activity)
### Stars
[**684**
stars](/philburk/pforth/stargazers)
### Watchers
[**42**
watching](/philburk/pforth/watchers)
### Forks
[**114**
forks](/philburk/pforth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fphilburk%2Fpforth&report=philburk+%28user%29)
## [Releases 2](/philburk/pforth/releases)
[v2.0.1
Latest
Jan 9, 2023](/philburk/pforth/releases/tag/v2.0.1)
[+ 1 release](/philburk/pforth/releases)
## [Packages 0](/users/philburk/packages?repo_name=pforth)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## [Contributors 17](/philburk/pforth/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
[+ 3 contributors](/philburk/pforth/graphs/contributors)
## Languages
* [C
51.6%](/philburk/pforth/search?l=c)
* [Forth
43.7%](/philburk/pforth/search?l=forth)
* [Makefile
3.7%](/philburk/pforth/search?l=makefile)
* Other
1.0%
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.

View File

@@ -0,0 +1,590 @@
# zForth
**Source:** https://github.com/zevv/zForth
GitHub - zevv/zForth: zForth: tiny, embeddable, flexible, compact Forth scripting language for embedded systems
[Skip to content](#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fzevv%2FzForth)
Appearance settings
* Platform
+ AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
+ DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
+ APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
+ EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com)
- [Blog](https://github.blog)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
* Solutions
+ BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
+ BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
+ BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
* Resources
+ EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
+ EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com)
+ SUPPORT & SERVICES
- [Documentation](https://docs.github.com)
- [Customer support](https://support.github.com)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
* Open Source
+ COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
+ PROGRAMS
- [Security Lab](https://securitylab.github.com)
- [Maintainer Community](https://maintainers.github.com)
- [Accelerator](https://github.com/accelerator)
- [Archive Program](https://archiveprogram.github.com)
+ REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
* Enterprise
+ ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
+ AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
* [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
Search
Clear
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our [documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).
Cancel
Create saved search
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fzevv%2FzForth)
[Sign up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=zevv%2FzForth)
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
[zevv](/zevv)
/
**[zForth](/zevv/zForth)**
Public
* [Notifications](/login?return_to=%2Fzevv%2FzForth) You must be signed in to change notification settings
* [Fork
57](/login?return_to=%2Fzevv%2FzForth)
* [Star
408](/login?return_to=%2Fzevv%2FzForth)
zForth: tiny, embeddable, flexible, compact Forth scripting language for embedded systems
### License
[MIT license](/zevv/zForth/blob/master/LICENSE)
[408
stars](/zevv/zForth/stargazers) [57
forks](/zevv/zForth/forks) [Branches](/zevv/zForth/branches) [Tags](/zevv/zForth/tags) [Activity](/zevv/zForth/activity)
[Star](/login?return_to=%2Fzevv%2FzForth)
[Notifications](/login?return_to=%2Fzevv%2FzForth) You must be signed in to change notification settings
* [Code](/zevv/zForth)
* [Issues
1](/zevv/zForth/issues)
* [Pull requests
2](/zevv/zForth/pulls)
* [Actions](/zevv/zForth/actions)
* [Projects
0](/zevv/zForth/projects)
* [Security
0](/zevv/zForth/security)
* [Insights](/zevv/zForth/pulse)
Additional navigation options
* [Code](/zevv/zForth)
* [Issues](/zevv/zForth/issues)
* [Pull requests](/zevv/zForth/pulls)
* [Actions](/zevv/zForth/actions)
* [Projects](/zevv/zForth/projects)
* [Security](/zevv/zForth/security)
* [Insights](/zevv/zForth/pulse)
# zevv/zForth
master
[Branches](/zevv/zForth/branches)[Tags](/zevv/zForth/tags)
Go to file
Code
Open more actions menu
## Folders and files
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- | --- |
| Latest commit History[141 Commits](/zevv/zForth/commits/master/) 141 Commits | | |
| [.github/workflows](/zevv/zForth/tree/master/.github/workflows "This path skips through empty directories") | | [.github/workflows](/zevv/zForth/tree/master/.github/workflows "This path skips through empty directories") | | |
| [forth](/zevv/zForth/tree/master/forth "forth") | | [forth](/zevv/zForth/tree/master/forth "forth") | | |
| [src](/zevv/zForth/tree/master/src "src") | | [src](/zevv/zForth/tree/master/src "src") | | |
| [.gitattributes](/zevv/zForth/blob/master/.gitattributes ".gitattributes") | | [.gitattributes](/zevv/zForth/blob/master/.gitattributes ".gitattributes") | | |
| [.gitignore](/zevv/zForth/blob/master/.gitignore ".gitignore") | | [.gitignore](/zevv/zForth/blob/master/.gitignore ".gitignore") | | |
| [LICENSE](/zevv/zForth/blob/master/LICENSE "LICENSE") | | [LICENSE](/zevv/zForth/blob/master/LICENSE "LICENSE") | | |
| [Makefile](/zevv/zForth/blob/master/Makefile "Makefile") | | [Makefile](/zevv/zForth/blob/master/Makefile "Makefile") | | |
| [README.md](/zevv/zForth/blob/master/README.md "README.md") | | [README.md](/zevv/zForth/blob/master/README.md "README.md") | | |
| [zforth.png](/zevv/zForth/blob/master/zforth.png "zforth.png") | | [zforth.png](/zevv/zForth/blob/master/zforth.png "zforth.png") | | |
| View all files | | |
## Repository files navigation
* [README](#)
* [MIT license](#)
[![zForth](/zevv/zForth/raw/master/zforth.png)](/zevv/zForth/blob/master/zforth.png)
# zForth
From Wikipedia:
*A Forth environment combines the compiler with an interactive shell, where
the user defines and runs subroutines called words. Words can be tested,
redefined, and debugged as the source is entered without recompiling or
restarting the whole program. All syntactic elements, including variables
and basic operators are defined as words. Forth environments vary in how the
resulting program is stored, but ideally running the program has the same
effect as manually re-entering the source.*
zForth is yet another Forth, but with some special features not found in most
other forths. Note that zForth was written for engineers, not for language
purists or Forth aficionados. Its main intention is to be a lightweight
scripting language for extending embedded applications on small
microprocessors. It is not particularly fast, but should be easy to integrate
on any platform with a few kB's of ROM and RAM.
Also note that zForth is just *a* forth, but does not specifically implement or
care about any of the standards like ANS Forth - the kernel might or might not
behave as the standard, and the current standard library is rather limited.
For a lot of programmers Forth seems to belong to the domain of alien
languages: it does not look like any mainstream language most people encounter,
and is built on a number of philosophies that takes some time to get used to.
Still, it is one of the more efficient ways of bringing a interpreter and
compiler to a platform with restricted resources.
Some of zForth's highlights:
* **Small dictionary**: instead of relying on a fixed cell size, the dictionary is
written in variable length cells: small and common numbers take less space
then larger, resulting in 30% to 50% space saving
* **Portable**: zForth is written in 100% ANSI C, and runs on virtually all
operating systems and all architectures. Tested on x86 Linux/Win32/MS-DOS
(Turbo-C 1.0!), x86\_64, ARM, ARM thumb, MIPS, Atmel AVR and the 8051.
* **Small footprint**: the kernel C code compiles to about 3 or 4 kB of machine
code, depending on the architecture and chosen cell data types.
* **Support for multiple instances**: The compiler and VM state is stored in a
struct, allowing multiple instances of zForth to run in parallel.
* **Tracing**: zForth is able to show a nice trace of what it is doing under the
hood, see below for an example.
* **VM**: Implemented as a small virtual machine: not the fastest, but safe and
flexible. Instead of having direct access to host memory, the forth VM memory
is abstracted, allowing proper boundary checking on memory accesses and stack
operations.
* **Flexible data types**: at compile time the user is free to choose what C data
type should be used for the dictionary and the stacks. zForth supports signed
integer sizes from 16 to 128 bit, but also works seamlessly with floating point
types like float and double (or even the C99 'complex' type!)
* **Ease interfacing**: calling C code from forth is easy through a host system
call primitive, and code has access to the stack for exchanging data between
Forth and C. Calling forth from C is easy, just one function to evaluate forth
code.
# Source layout
```
./forth : core zforth library and various snippets and examples
./src/zforth : zfort core source; embed these into your program
./src/linux : example linux application
./src/atmega8 : example AVR atmega8 application
```
# Usage
zForth consists of only two files: zforth.c and zforth.h. Add both to your
project and call `zf_init()` and `zf_bootstrap()` during initialisation. Read
forth statements from a file or terminal and pass the strings to `zf_eval()` to
interpret, compile and run the code. Check the embedded documentation in
`zforth.h` for details.
`zforth.c` depends on a number preprocessor constants for configuration which
you can choose to fit your needs. Documentation is included in the file
`zfconf.h`.
A demo application for running zForth in linux is provided here, simply run `make`
to build.
To start zForth and load the core forth code, run:
```
./src/linux/zforth forth/core.zf
```
And zForth will welcome you with the startup message:
```
Welcome to zForth, 786 bytes used
```
zForth is now ready to use. Try some of the following:
Adding one and one or calculate the 144 squared:
```
1 1 + .
144 dup * .
```
Print the sine of 10 numbers between 0 and PI
```
: pi 3.141592654 ;
: demo pi 0 do i sin . pi 10 / loop+ ;
demo
```
Load and run the demo Mandelbrot fractal:
```
include forth/mandel.zf
.........................----.....................
.....................----+--......................
.......................--*-.......................
........................- --.....--...............
...........----........--%---------...............
............-------------#---------...............
.............------------ ---------...............
.............------------ ---------...............
..............---------o o--------..............
..............---------o =----------------------
.............----o-oo =o-=--------------..
...........-------# *------------.....
........--------=-= o-=--------.......
....--------------= =---------........
......-------------+ +---------.........
.......-------------=# %=-----------........
........--------=- -=--------.......
.......------= =------------
.....---o = = =-------
--------- --------
---------o+ +o--------
---------o =--------
---=#=# = = #=#=--
---= =--
-=- + + ==
o---oo*== -=*=o---
---------= =--------
---------#= =#--------
-----------% %------....
---...----= =% - #= =----.....
.......---=o----* =+*---------*+- *----o=----.....
........--------------------------------------....
```
# Tracing
zForth can write verbose traces of the code it is compiling and running. To enable
tracing, run `./zforth` with the `-t` argument. Tracing can be enabled at run time
by writing `1` in the `trace` variable:
```
1 trace !
```
Make sure the feature ZF\_ENABLE\_TRACING is enabled in zfconf.h to compile in
tracing support.
The following symbols are used:
* stack operations are prefixed with a double arrow, `«` means pop, `»` means push.
for operations on the return stack the arrow is prefixed with an `r`
* the current word being executed is shown in square brackets, the format
is `[<name>/<address>]`
* lines starting with a + show values being added to the dictionary
* lines starting with a space show the current line being executed, format
`<address> <data>`
* lines starting with `===` show the creation of a new word
```
: square dup * ;
: test 5 square . ;
test
```
Executing the word `test`:
```
test
r»0
[test/0326]
0326 0001 ┊ (lit) »5
0328 031c ┊ square/031c r»810
031c 000b ┊ ┊ (dup) «5 »5 »5
031d 0007 ┊ ┊ (*) «5 «5 »25
031e 0000 ┊ ┊ (exit) r«810
032a 0133 ┊ ./0133 r»812
0133 0001 ┊ ┊ (lit) »1
0135 0019 ┊ ┊ (sys) «1 «25
0136 0000 ┊ ┊ (exit) r«812
032c 0000 ┊ (exit) r«0 25
```
This is the trace of the definition of the `square` and `test` words
```
: square dup * ;
r»0
[:/002c]
002c 0003 ┊ (:)
002c 0003 ┊ (:)
=== create 'square'
+0313 0006 ¹
+0314 02eb ²
+0316 0000 s 'square'
===
002d 0000 ┊ (exit) r«0
+031c 000b ¹ +dup
+031d 0007 ¹ +*r»0
[;/0031]
0031 0004 ┊ (;)
+031e 0000 ¹ +exit
===
0032 0000 ┊ (exit) r«0
: test 5 square . ;
r»0
[:/002c]
002c 0003 ┊ (:)
002c 0003 ┊ (:)
=== create 'test'
+031f 0004 ¹
+0320 0313 ²
+0322 0000 s 'test'
===
002d 0000 ┊ (exit) r«0
+0326 0001 ¹ +lit
+0327 0005 ¹
+0328 031c ² +square
+032a 0133 ² +.r»0
[;/0031]
0031 0004 ┊ (;)
+032c 0000 ¹ +exit
===
0032 0000 ┊ (exit) r«0
```
### Dependencies
The zForth core itself has no external dependencies, the linux example depends on libreadline-dev.
## About
zForth: tiny, embeddable, flexible, compact Forth scripting language for embedded systems
### Topics
[scripting-language](/topics/scripting-language "Topic: scripting-language")
[forth](/topics/forth "Topic: forth")
### Resources
[Readme](#readme-ov-file)
### License
[MIT license](#MIT-1-ov-file)
### Uh oh!
There was an error while loading. Please reload this page.
[Activity](/zevv/zForth/activity)
### Stars
[**408**
stars](/zevv/zForth/stargazers)
### Watchers
[**21**
watching](/zevv/zForth/watchers)
### Forks
[**57**
forks](/zevv/zForth/forks)
[Report repository](/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fzevv%2FzForth&report=zevv+%28user%29)
## [Releases](/zevv/zForth/releases)
No releases published
## [Packages 0](/users/zevv/packages?repo_name=zForth)
No packages published
### Uh oh!
There was an error while loading. Please reload this page.
## [Contributors 14](/zevv/zForth/graphs/contributors)
### Uh oh!
There was an error while loading. Please reload this page.
## Languages
* [C
81.1%](/zevv/zForth/search?l=c)
* [Forth
15.7%](/zevv/zForth/search?l=forth)
* [Makefile
3.2%](/zevv/zForth/search?l=makefile)
## Footer
© 2026 GitHub, Inc.
### Footer navigation
* [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
* [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
* [Security](https://github.com/security)
* [Status](https://www.githubstatus.com/)
* [Community](https://github.community/)
* [Docs](https://docs.github.com/)
* [Contact](https://support.github.com?tags=dotcom-footer)
* Manage cookies
* Do not share my personal information
You cant perform that action at this time.