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