# 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 can’t perform that action at this time.