Recently Written · git

recentlywritten

my writings (done recently)

git clone https://github.com/equwal/recentlywritten

Log | Files | Refs


git/Forthe/commit/9bd275f7aaed925608d727cd9781825a89551b48.html (4914 bytes)

1 <!DOCTYPE html>
2 <html lang="en"><head><meta charset="UTF-8" />
3 <meta name="viewport" content="width=device-width, initial-scale=1" />
4 <title>Forthe 9bd275f7 - Recently Written</title>
5 <link rel="stylesheet" href="../../stagit.css" />
6 </head><body>
7 <div id="top"><a href="../../../index.html">Recently Written</a> &middot; <a href="../../index.html">git</a></div>
8 <h1>Forthe</h1><span class="desc">Forth-like DSL.</span><p class="url">git clone https://github.com/equwal/Forthe</p><p><a href="../../Forthe/index.html">Log</a> | <a href="../../Forthe/files.html">Files</a> | <a href="../../Forthe/refs.html">Refs</a></p><hr/>
9 <div id="content">
10 <pre>commit 9bd275f7aaed925608d727cd9781825a89551b48
11 Spenser Truex &lt;spensertruexonline@gmail.com&gt;
12 2019-06-22 17:42:04 -0700
13 
14 I just threw it together
15 
16 </pre><pre> README.org | 42 ++++++++++++++++++++++++++++++------------
17  1 file changed, 30 insertions(+), 12 deletions(-)
18 </pre><pre>diff --git a/README.org b/README.org
19 index 939a473..8da6d34 100644
20 --- a/README.org
21 +++ b/README.org
22 <span class="h">@@ -10,18 +10,6 @@ definitions are provided at all to the eForth macro from the library.</span>
23  The main benefit comes from reducing the verbosity of elisp in a small
24  Domain Specific Language the programmer defines.
25  
26 <span class="d">-* How? Forth code is</span>
27 <span class="d">-gone through by the pointer moving through the call stack. When a</span>
28 <span class="d">-non-function is found, it is added to the argument stack. When a</span>
29 <span class="d">-function is found, it uses up the argument stack if it has arguments, or</span>
30 <span class="d">-just runs if it is nullary. Nothing else is provided by the</span>
31 <span class="d">-implementation. # Why? Needing to simulate a long set of keypresses to</span>
32 <span class="d">-create an eight panel frame (37 in total), the best option seemeed to be</span>
33 <span class="d">-obviously to create a miniature language with 1 or 2 letter</span>
34 <span class="d">-abbreviations for each. Any arguments to a function can be passed before</span>
35 <span class="d">-it in the list, and there is no need to define a return stack. # Usage:</span>
36 <span class="d">-example:</span>
37 <span class="d">-</span>
38  #+BEGIN_SRC emacs-lisp :tangle no
39  (require &#x27;eforth)
40  (defun 8pan ()
41 <span class="h">@@ -40,6 +28,35 @@ example:</span>
42                wr n wr n wl wl wl wd n wr n wr n wr n wl wl wl wu nf)))
43  #+END_SRC
44  
45 <span class="a">+* How does a FORTH work?</span>
46 <span class="a">+Forth code is gone through by the pointer moving through the call stack. When a</span>
47 <span class="a">+non-function is found, it is added to the argument stack. When a function is</span>
48 <span class="a">+found, it uses up the argument stack if it has arguments, or just runs if it is</span>
49 <span class="a">+nullary. Nothing else is provided by the implementation.</span>
50 <span class="a">+* Why?</span>
51 <span class="a">+Needing to simulate a long set of keypresses to create an eight panel frame (37</span>
52 <span class="a">+in total), the best option seemeed to be obviously to create a miniature</span>
53 <span class="a">+language with 1 or 2 letter abbreviations for each. Any arguments to a function</span>
54 <span class="a">+can be passed before it in the list, and there is no need to define a return</span>
55 <span class="a">+stack.</span>
56 <span class="a">+* Usage: example:</span>
57 <span class="a">+#+BEGIN_SRC emacs-lisp :tangle no</span>
58 <span class="a">+(require &#x27;eforth)</span>
59 <span class="a">+(defun 8pan ()</span>
60 <span class="a">+  (interactive)</span>
61 <span class="a">+  (eforth &#x27;((n . (lambda () (switch-to-buffer nil)))</span>
62 <span class="a">+            (d . split-window-below)</span>
63 <span class="a">+            (r . split-window-right)</span>
64 <span class="a">+            (wr . windmove-right)</span>
65 <span class="a">+            (wl . windmove-left)</span>
66 <span class="a">+            (wd . windmove-down)</span>
67 <span class="a">+            (wu . windmove-up)</span>
68 <span class="a">+            (del . delete-other-windows)</span>
69 <span class="a">+            (cf . make-frame-command)</span>
70 <span class="a">+            (nf . other-frame))</span>
71 <span class="a">+          (cf del r r wr wr r d wr d wl wl d wl d wr n</span>
72 <span class="a">+              wr n wr n wl wl wl wd n wr n wr n wr n wl wl wl wu nf)))</span>
73 <span class="a">+#+END_SRC</span>
74  =M-x 8pan= will produce a new frame with eight panels (emacs-speak:
75  &quot;windows&quot;). Here is how it works:
76  
77 <span class="h">@@ -79,6 +96,7 @@ compiler is in fact a trivial exercise.</span>
78  
79  * Drawbacks
80  ** Elispers might not want to read your eFORTH code
81 <span class="a">+** eForth is not stable</span>
82  ** Isn&#x27;t verbose code self-documenting?
83  NO. Documented code is documented. Using short names with the bindings handily
84  available in the same form is equally explicit as writing them out every time.</pre>
85 </div></body></html>