Skip to content

A Forth cross compiler written in Forth with Gforth to create machine code programs for the ZX Spectrum and compatible computers.

License

Notifications You must be signed in to change notification settings

programandala-net/sin-forth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sin Forth

Description

Sin Forth is a Forth cross compiler under development, written in Forth with Gforth.

Sin Forth creates machine code programs for any model of ZX Spectrum or compatible computer, including the ZX Spectrum Next.

Author’s website: http://programandala.net.

Installation

The installation of Sin Forth needs two operations:

  1. Make its sources accessible from Gforth.

  2. Copy or link the compiler file (src/sin_forth.fs) in a directory of the system PATH.

Sources

There are two methods to make Sin Forth’s sources accessible from Gforth:

  1. Add the Sin Forth’s <src> directory to Gforth’s fpath. Consult Gforth’s documentation.

  2. Make a symbolic link to Sin Forth’s <src> directory in Gforth’s <site-forth> directory. In a locally compiled Gforth, the command on a Linux shell would be the following:

    sudo ln -s SIN_FORTH_PATH/src/ /usr/local/share/gforth/site-forth/sin_forth

    where "SIN_FORTH_PATH" must be replaced with the corresponding path to Sin Forth’s directory on your system.

Compiler

In order to make <src/sin_forth.fs> accessible anywhere, you may link it to any directory in your system PATH, removing its filename extension for convenience:

Example:

ln -s SIN_FORTH_PATH/src/sin_forth.fs DIR/sin_forth

where "SIN_FORTH_PATH" must be replaced with the corresponding path to Sin Forth’s directory on your system, and "DIR" can be replaced with ~/bin or ~/.local/bin.

Requirements

  • Sin Forth uses some modules of the Galope library.

  • Some modules of Galope need modules of the Forth Foundation Library.

  • Sin Forth makes the ZX Spectrum .tap files by Metalbrain’s bin2tap, which must be installed in the system.

Project directories

doc

Manuals in EPUB, HTML and PDF

src

Compiler sources

src/doc

Documentation sources

src/lib

Library sources

src/test

Tests sources

target

Compiled and disassembled tests

tmp

Temporary files created by make

The name

Sin Forth is a "sin", because the programs it creates are not actual Forth:

  • No dictionary.

  • No outer interpreter.

  • No inner interpreter: the "compiled" code is a collection of machine code subroutines, like in a STC (Subroutine-Threaded Code) Forth.

  • No distinction between interpretation and compilation modes in the source code of the programs: during the "compilation", parsing and "immediate" operations are done by host words, i.e. Gforth words.

Besides, "sin Forth" is the Spanish for "without Forth", which is another way to describe Sin Forth.

Last, "Sin" is borrowed from "Sinclair".

History of the repository

  • 2018-08-19: A Git repository was created from the development backups in order to resume the development.

  • 2020-12-06: The Git repository was converted to Fossil.

  • 2020-12-18: A GitHub mirror was configured in the Fossil repository.

  • 2023-04-05: The repository was converted to Mercurial, enabling a better interaction with GitHub.

  • 2023-10-13: The repository was published on Sourcehut; GitHub is kept as a mirror.

About

A Forth cross compiler written in Forth with Gforth to create machine code programs for the ZX Spectrum and compatible computers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published