|
|
notes on forth |
|
|
|
|
|
|
|
___ __ __ |
|
|
|
/ _/__ ____/ /_/ / |
|
|
|
/ _/ _ \/ __/ __/ _ \ |
|
|
|
/_/ \___/_/ \__/_//_/ |
|
|
|
|
|
|
|
|
|
|
|
# BASIC PRINCIPLES |
|
|
|
|
|
|
|
- keep it simple: make programs which can fit in 4K words of core |
|
|
|
- do not speculate: do not put code in your program that MIGHT be used |
|
|
|
- do it yourself |
|
|
|
|
|
|
|
# INPUT |
|
|
|
|
|
|
|
information that controls a program |
|
|
|
|
|
|
|
- not moving data between media (copying) |
|
|
|
- not reading data (displaying) |
|
|
|
|
|
|
|
# VARIABLES |
|
|
|
|
|
|
|
- declare them before everyting else |
|
|
|
- make them global |
|
|
|
|
|
|
|
# WORDS |
|
|
|
|
|
|
|
- use nouns for variables, verbs for functions, adjectives for ... states? |
|
|
|
- make words mnemonic |
|
|
|
- keep them short |
|
|
|
|
|
|
|
# QUOTES |
|
|
|
|
|
|
|
The point of Forth is making software open and transparent to its users, |
|
|
|
by providing a scripting engine with a minimum of effort. |
|
|
 |
felix plesoianu (https://felix.plesoianu.ro) |
text/html |
|
|
|
|
|
|
Forth is a programming environment for CREATING application oriented |
|
|
|
languages. |
|
|
 |
thinking forth by leo brodie, p. 24 (https://www.forth.com) |
application/pdf |
|
|
|
|
|
|
With the huge RAM of modern computers, an operating system is no longer |
|
|
|
necessary. |
|
|
 |
chuck moore (https://colorforth.github.io) |
text/html |
|
|
|
|
|
|
If the operating system can open, close, read, write, buffer, sort |
|
|
|
or index a file, why should such code be in a program? Why a need to |
|
|
|
update the screen coordinates in the program control file when the |
|
|
|
operating system can as it has the information first and interfaces |
|
|
|
to the storage system. So we are back to the BASIS OF FORTH: |
|
|
|
- don't duplicate code |
|
|
|
- leverage what you have already created |
|
|
|
- refactor |
|
|
 |
OS/Forth (http://www.forth.org) |
text/html |
|
|
|
|
|
|
what is forth? |
|
|
|
|
|
|
|
- trivial syntax (whitespace-separated tokens) |
|
|
|
- trivial compiler (words are simply sequenced) |
|
|
|
- 2 stacks: allows words to consume and generate arguments |
|
|
|
- everything is executable |
|
|
|
- reverse polish notation (RPN) |
|
|
|
- tokens are simply executed left-to-right |
|
|
|
- dictionary has 2 meanings: |
|
|
|
- the heap: all the words and their data /~moreno/forth/ - the heap: all the words and their data tilde.team 70 |
|
|
|
- the association of tokens with their code /~moreno/forth/ - the association of tokens with their code tilde.team 70 |
|
|
 |
bootstrap yourself into conviviality by writing your own Forth (https://raw.githubusercontent.com) |
|
|
|
|
|
|
|
# NOTES |
|
|
|
|
|
|
|
- an application language is a problem oriented language |
|
|
|
- a problem oriented language should be able to express any problem |
|
|
|
encountered |
|
|
|
- 4k of 16 bits (2 bytes) words |
|
|
|
- Extensible via colon words, code words, and new data types |
|
|
|
|
|
|
|
# INTERPRETER/COMPILER OF A FORTH SYSTEM |
|
|
|
|
|
|
 |
flow chart |
image/gif |
|
 |
beginner's guide (https://galileo.phys.virginia.edu) |
text/html |
|
|
|
|
|
|
# THINK FORTH AS THE FUTURE |
|
|
|
|
|
|
|
- tiny, ubiquitous computers |
|
|
|
- solar power |
|
|
|
- heavily constrained VMs |
|
|
|
- more elegant programs |
|
|
|
- concatenative programming |
|
|
|
- combinators |
|
|
 |
talk by dave gauer (https://ratfactor.com) |
text/html |
|
|
|
|
|
|
# ALTERNATIVES TO VON NEUMANN LANGUAGES |
|
|
|
|
|
|
 |
functional programming languages |
text/plain |
|
|
|
|
|
|
# IMPLEMENTATIONS |
|
|
|
|
|
|
 |
14f (https://14f.ichi.city) |
text/html |
|
 |
colorforth (https://colorforth.github.io) |
text/html |
|
 |
foth (https://github.com) |
|
|
 |
psi-forth (https://git.sr.ht) |
|
|
 |
nasmjf (https://ratfactor.com) |
|
|
 |
sectorforth (8 primitives) (https://github.com) |
|
|
 |
OneFileForth (https://github.com) |
|
|
|
|
|
|
|
## COLOR FORTH VARIANTS |
|
|
|
|
|
|
 |
retro forth (https://www.retroforth.org) |
|
|
 |
r3 (https://github.com) |
|
|
 |
colorforth-pbr (https://github.com) |
|
|
 |
colorforth 2019 (https://github.com) |
|
|
 |
ripen (https://felix.plesoianu.ro) |
text/html |
|
|
|
|
|
|
## FORTH IN RUST |
|
|
|
|
|
|
 |
rtforth (https://github.com) |
|
|
 |
forth-in-rust (https://github.com) |
|
|
 |
fifth (https://git.sr.ht) |
|
|
|
|
|
|
|
## FORTH IN JS |
|
|
|
|
|
|
 |
hhwebforth (https://github.com) |
|
|
 |
eForth |
application/pdf |
|
|
|
|
|
|
## ON RISC-V PLATFORM |
|
|
|
|
|
|
 |
noForth (https://home.hccnet.nl) |
text/html |
|
 |
for microcontrollers (https://github.com) |
|
|
 |
muforth cross-compiler (https://muforth.nimblemachines.com) |
|
|
 |
lbforth self hosting metacompiled (https://github.com) |
|
|
 |
port of jonesforth (https://github.com) |
|
|
 |
another port of jonesforth (https://github.com) |
|
|
 |
derzforth bare-metal (https://github.com) |
|
|
 |
riscyforth assembler (https://github.com) |
|
|
|
|
|
|
|
## 64 BITS |
|
|
|
|
|
|
 |
sixtyforth (https://gitlab.com) |
|
|
|
|
|
|
|
# COMPILERS |
|
|
|
|
|
|
 |
build a compiler (http://home.iae.nl) |
text/html |
|
 |
4tH (https://thebeez.home.xs4all.nl) |
text/html |
|
 |
kim harris notes (http://www.forth.org) |
application/pdf |
|
|
|
|
|
|
# VM |
|
|
|
|
|
|
 |
c4 (https://github.com) |
|
|
|
|
|
|
|
# OS |
|
|
|
|
|
|
 |
duskOS (https://sr.ht) |
|
|
|
|
|
|
|
# CONCATENATIVE SHELL |
|
|
|
|
|
|
 |
cosh (https://github.com) |
|
|
|
|
|
|
|
# RISC-V REFERENCES |
|
|
|
|
|
|
 |
assembly programmer's manual (https://github.com) |
|
|
 |
specs (https://riscv.org) |
|
|
|
|
|
|
|
____________________________________________________________________________ |
|
|
|
Gophered by Gophernicus/3.0.1 on Ubuntu/22.04 x86_64 |
|