|
|
article-tgtimes-Embedded-Forth-Programming.mw - tgtimes - The Gopher Times |
|
|
 |
git clone git://bitreich.org/tgtimes git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tgtimes (git://bitreich.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
Tags |
|
|
 |
README |
|
|
|
--- |
|
|
|
article-tgtimes-Embedded-Forth-Programming.mw (5994B) |
|
|
|
--- |
|
|
|
1 .SH tgtimes |
|
|
|
2 Embedded Forth Programming |
|
|
|
3 .2C 10v |
|
|
|
4 . |
|
|
|
5 .PP |
|
|
|
6 Big computers can run large and complex programming languages, |
|
|
|
7 so what can small computer run? |
|
|
|
8 . |
|
|
|
9 .PP |
|
|
|
10 Compiled languages, in particular those with a small runtime are often chosen. |
|
|
|
11 But the interpreted languages also have an audience willing to code with their favorite programming environment for them. |
|
|
|
12 Programming languages as big as Python have their embedded counterpart (MicroPython) thanks to significant efforts. |
|
|
|
13 They serve their purpose to embedded enthusiasts as educational and scripting languages to many. |
|
|
|
14 . |
|
|
|
15 .PP |
|
|
|
16 But small "language in a nutshell" are fitting right the small resources of microcontrollers. |
|
|
|
17 This is the case of Forth and its stack-machine approach. |
|
|
|
18 . |
|
|
|
19 .1C |
|
|
|
20 . |
|
|
|
21 .IP Mecrisp Forth - http://mecrisp.sourceforge.net/ |
|
|
|
22 This implementation immediately targets microcontrollers. |
|
|
|
23 See for instance the work of librehacker.com author Christopher Howard. |
|
|
|
24 .FS |
|
|
|
25 gemini://gem.librehacker.com/gemlog/tech/20220331-0.gmi |
|
|
|
26 gemini://gem.librehacker.com/gemlog/tech/20220305-0.gmi |
|
|
|
27 .FE |
|
|
|
28 . |
|
|
|
29 .IP chipFORTH |
|
|
|
30 Another implementation of Forth, which were used by NASA |
|
|
|
31 .FS |
|
|
|
32 https://www.forth.com/space-shuttle-instrumentation-interface/ |
|
|
|
33 .FE |
|
|
|
34 for improving reliability of its flight control system, |
|
|
|
35 among the mosts critical pieces of software of a shuttle. |
|
|
|
36 . |
|
|
|
37 .IP https://github.com/corecode/forth |
|
|
|
38 Among notable Forth projects is Simon "corecode" Schubert's nimble forth implementation |
|
|
|
39 as well as hardware code describing the working of a CPU that executes Forth natively |
|
|
|
40 .FS |
|
|
|
41 https://github.com/corecode/forth-cpu |
|
|
|
42 .FE |
|
|
|
43 . |
|
|
|
44 .IP https://forth.chat/ |
|
|
|
45 If feeling like having a taste of Forth and Forth community, there are several channels |
|
|
|
46 featuring forth that you could enjoy, |
|
|
|
47 some of which are oriented toward hardware projects directly |
|
|
|
48 .FS |
|
|
|
49 ircs://irc.hackint.org/#forth-hardware-projects |
|
|
|
50 .FE. |
|
|
|
51 . |
|
|
|
52 .IP https://github.com/chmykh/apl-life |
|
|
|
53 This is Conway Game of Life in APL in Forth |
|
|
|
54 What a long chain! It is APL programming language implemented in Forth, |
|
|
|
55 and Conway game of life implemented in APL |
|
|
|
56 . |
|
|
|
57 .IP https://github.com/remko/waforth |
|
|
|
58 Feeling like pushing the irony of "Web" assembly even further? |
|
|
|
59 Why not blasting a Forth implementation at it? |
|
|
|
60 .FS |
|
|
|
61 https://el-tramo.be/waforth/ |
|
|
|
62 https://el-tramo.be/thurtle/ |
|
|
|
63 .FE |
|
|
|
64 This proves Forth as the new programming language \fIen vogue\fR |
|
|
|
65 . |
|
|
|
66 .IP http://collapseos.org/ |
|
|
|
67 What else does a programming language need to prove itself useful? |
|
|
|
68 A kernel? Check! |
|
|
|
69 Collapse OS |
|
|
|
70 is an operating system targetting resilience beyond extreme, |
|
|
|
71 as it is designed to resist everything around it tearing apart, |
|
|
|
72 including the whole civilisation. |
|
|
|
73 When nothing remains but wastelands, |
|
|
|
74 CollapseOS will be there for a rebirth of civilisation out of computers made from scavenged parts. |
|
|
|
75 Civilisation is rising and falling all of the time, just not all parts at the same time. |
|
|
|
76 . |
|
|
|
77 .QP |
|
|
|
78 Forth is, to my knowledge, the most compact language allowing high level constructs. -- Collapse OS author. |
|
|
|
79 . |
|
|
|
80 .IP "gopher://retroforth.org/ https://retroforth.org/" |
|
|
|
81 A forth implemented in C, Python, C#, Nim, JavaScript and Pascal! |
|
|
|
82 The C version permits to embed the script into a binary along with the interpreter, |
|
|
|
83 for a single-binary deployment process. |
|
|
|
84 The more classic way to use it is to use shebangs scripts to have executable scripts. |
|
|
|
85 . |
|
|
|
86 .PP |
|
|
|
87 Many smaller utilities can already provide something you needed: |
|
|
|
88 . |
|
|
|
89 .IP http://retroforth.org/examples/Casket-HTTP.retro.html |
|
|
|
90 An HTTP server |
|
|
|
91 . |
|
|
|
92 .IP http://retroforth.org/examples/Atua-WWW.retro.html |
|
|
|
93 A Gopher to HTTP+HTML Proxy on top of Atua. |
|
|
|
94 . |
|
|
|
95 .IP http://retroforth.org/examples/Atua.retro.html Gopher server |
|
|
|
96 A gopher server, already listed on the Gopher index of links, the Gopher Lawn |
|
|
|
97 .FS |
|
|
|
98 bitreich.org/1/lawn/c/gopher.gph |
|
|
|
99 .FE |
|
|
|
100 . |
|
|
|
101 .IP http://retroforth.org/examples/7080.retro.html |
|
|
|
102 A s |
|
|
|
103 . |
|
|
|
104 .IP https://gitlab.com/goblinrieur/spreedsheet/ |
|
|
|
105 A spreadsheet application in the terminal. |
|
|
|
106 . |
|
|
|
107 .IP gopher://forth.works:100 http://forthworks.com/ |
|
|
|
108 This is a collection of code blocks written in the Retro Forth's author (crc) newest Forth implementation. |
|
|
|
109 It is itself served by a gopher server (blocks 203-205 on the list above) in Forth. |
|
|
|
110 . |
|
|
|
111 .IP https://github.com/oriontransfer/pl0-language-tools |
|
|
|
112 A PL/0 implementation in Python that can emmit Retro Forth code as ouput. |
|
|
|
113 It looks like Forth simplicity, portability, stability and speed of execution made it a good candidate as a target language. |
|
|
|
114 The PL/0 language is known for the book \fIAlgorithms + Data Structures = Programs\fR |
|
|
|
115 from Niklaus Wirth, himself famous for the Wirth Law: |
|
|
|
116 . |
|
|
|
117 .QP |
|
|
|
118 The hope is that the progress in hardware will cure all software ills. |
|
|
|
119 However, a critical observer may observe that software manages to outgrow hardware in size and sluggishness. |
|
|
|
120 -- https://en.wikipedia.org/wiki/Wirth's_law |
|
|
|
121 . |
|
|
|
122 .IP https://ribccs.com/candy/ |
|
|
|
123 If you were doubting about Forth being fit for the industry, bear in mind that the above is |
|
|
|
124 a very-large scale VFX Forth project with over a million lines of code! |
|
|
|
125 . |
|
|
|
126 .IP http://sam-falvo.github.io/kestrel/2016/03/29/vibe-2.2 |
|
|
|
127 Why not spin a vi-like text editor itself in forth? |
|
|
|
128 See how few code it takes to implement one. |
|
|
|
129 . |
|
|
|
130 .IP https://git.sr.ht/~vertigo/shoehorn |
|
|
|
131 An answer to the bootstrapping problem: how to get from no software to a complete system? |
|
|
|
132 Which compiler compiles the first compiler? |
|
|
|
133 Forth's simplicity is a good candidate for solving this problem. |
|
|
|
134 . |
|
|
|
135 .IP https://git.sr.ht/~vertigo/forthbox |
|
|
|
136 Software environment for computers to base upon right after booting: |
|
|
|
137 a system shell in forth with real hardware projects dedicated to it. |
|
|
|
138 Think of a LISP machine, but instead being a Forth machine. |
|
|
|
139 . |
|
|
|
140 .IP http://deathroadtocanada.com/ |
|
|
|
141 This video-game uses Forth as a scripting language. |
|
|
|
142 When a whole scripting language fits on a thumb, putting it everywhere costs nothing! |
|
|
|
143 . |
|
|
|
144 .2C 4v |
|
|
|
145 . |
|
|
|
146 .PP |
|
|
|
147 Such a large tool chest for such a small language. |
|
|
|
148 With the Covid, Wars under disguise, and other supply chain troubles, |
|
|
|
149 the demand of feature stability rises face to the traditionnal "more features". |
|
|
|
150 In these trying times, anyone is welcome to go Forth. |
|