466 lines
17 KiB
Markdown
466 lines
17 KiB
Markdown
# 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 muforth’s. 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.
|
||
|
||
It’s [BSD licensed](/nimblemachines/muforth/blob/master/LICENSE), so do what you want with it! I’d 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. It’s 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 isn’t 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 isn’t that much of it, so
|
||
reading it is actually possible. That’s 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). You’ll 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 isn’t
|
||
that great, but you might find it interesting, or at least amusing.
|
||
|
||
It’s 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
|
||
```
|
||
|
||
[](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 can’t perform that action at this time. |