Files
2026-02-19 16:16:24 -05:00

543 lines
16 KiB
Markdown
Raw Permalink 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.
# 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.