Files
forth_bootslop/references/ForthNotes/lbForth.md
2026-02-19 16:16:24 -05:00

433 lines
17 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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.