Skip to main content

A minimalistic, Python-based Forth+ interpreter

Project description

PyForth

A Pythonic compiler for the Forth+ programming language

GitHub License

2025-09-06_16-39

Overview

PyForth is a minimalistic, Python-based compiler/interpreter for the Forth+ language. It aims to provide a straightforward and readable implementation while staying faithful to the Forth philosophy. Furthermore i added some python method as sort, reverse and the True is set to 1 instead of -1

Features

  • Written in pure Python (with a sample forth script )
  • Supports both file execution and an interactive REPL
  • Lightweight design—easy to understand and extend
  • Includes a sample Forth script (test.fs) for quick testing GitHub
  • supports by ForthRights in vscode extention store
  • it will can connect to python libraries easier
  • modern forth while keeping old options

Getting Started

Prerequisites

  • Python 3.x installed on your system.
  • (Optional but recommended) A virtual environment to manage dependencies.

Installation

Clone the repository:

git clone https://github.com/UndrDsk0M/PyForth.git
cd PyForth

Running the Interpreter

You can run PyForth with a Forth source file:

python pyforth.py test.fs

Or start an interactive REPL session:

python pyforth.py
# Then enter Forth code directly, e.g.:
1 2 + .
Stack<>  ok

Adjust accordingly based on your implementation details.

Example

Here’s a simple example of Forth code execution (assuming REPL-like behavior):

5 3 * .  \ This will output 15

Project Structure

PyForth/
├── pyforth.py    # Main Python moudle for the Forth interpreter
└── test.fs       # Sample Forth script with a error

Contributing

Contributions are welcome! Consider:

  • Adding new Forth words or operations
  • Improving performance or readability
  • Enhancing the test suite and coverage
  • suggeting new options or words in my Telegram!

Please:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/awesome).
  3. Commit your changes (git commit -am "Add awesome feature").
  4. Push to the branch (git push origin feature/awesome).
  5. Open a Pull Request for review. or just give a star the Project :)

License

This project is licensed under the MIT License

Acknowledgments

  • Developed by UndrDsk0M
  • Inspired by the elegance and extensibility of Forth and Python
2025-09-06_16-37

Next Steps

  • Compliting the if-else conditions, for, begin-until loops, and defining a word section. it also needs a float and string data type.
  • inlcude word to include both forth and python file and modules
  • If you'd like help refining any section, feel free to share more specifics, I’d be happy to assist!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyforth-1.2.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyforth-1.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file pyforth-1.2.0.tar.gz.

File metadata

  • Download URL: pyforth-1.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for pyforth-1.2.0.tar.gz
Algorithm Hash digest
SHA256 eb64453466ee20f698b8fb50004ea2154c4aff9bd54b3a617a5bcccb91eef36b
MD5 90136af32a25422e095195338d7b25b5
BLAKE2b-256 12f0a447089d8ce50ad72b067f1946ad2fd55ee87e2edcec82c688659b3140d3

See more details on using hashes here.

File details

Details for the file pyforth-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyforth-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for pyforth-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8173dc814424c8c1c5aed82ff7043774d9753e623c4348a69353a7906a6497e5
MD5 e4ff66997a7b6612780ee3026283e16a
BLAKE2b-256 ea79f74008582f95eae4aef378217a53f6d885693ebac7b4bc32373e14f37aad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page