Commit Graph

25 Commits

Author SHA1 Message Date
Kartik K. Agaram
26e9387df6 snapshot: infix
Like parenthesize, I'm copying tests over from https://github.com/akkartik/wart
Unlike parenthesize, though, I can't just transliterate the code itself.
Wart was operating on an intermediate AST representation. Here I'm all
the way down to cells. That seemed like a good idea when I embarked, but
now I'm not so sure. Operating with the right AST data structure allowed
me to more easily iterate over the elements of a list. The natural recursion
for cells is not a good fit.

This patch and the next couple is an interesting case study in what makes
Unix so effective. Yes, you have to play computer, and yes it gets verbose
and ugly. But just diff and patch go surprisingly far in helping build a
picture of the state space in my brain.

Then again, there's a steep gradient of skills here. There are people who
can visualize state spaces using diff and patch far better than me, and
people who can't do it as well as me. Nature, nurture, having different
priorities, whatever the reason. Giving some people just the right crutch
excludes others.
2021-06-22 21:23:40 -07:00
Kartik K. Agaram
0dda332ce3 .
Roll back to commit 70919b45f0. Recent commits add lots of extra function
args for dubious benefit.
2021-06-12 21:11:22 -07:00
Kartik K. Agaram
286819685e eliminate some implicit writes to real screen 2021-06-12 16:24:27 -07:00
Kartik K. Agaram
be9fa3780a .
Add argument to a few functions.
2021-06-09 21:05:29 -07:00
Kartik K. Agaram
67aeff8934 .
I wrote a comment about how some code was not covered by tests, and then
promptly forgot what it was for. This is why we need tests.

Now the hack is gone.
2021-06-08 15:06:08 -07:00
Kartik K. Agaram
bb1ccae27f rename the definition primitive to 'def' 2021-06-04 16:07:07 -07:00
Kartik K. Agaram
ee536ff3e8 . 2021-05-31 15:18:25 -07:00
Kartik K. Agaram
940401ff9e . 2021-05-31 10:19:38 -07:00
Kartik K. Agaram
3331144395 data.limg now loading properly again 2021-05-31 08:09:19 -07:00
Kartik K. Agaram
d2094133aa clearer test
It actually has nothing to do with macros. I just wasn't supporting backquotes
outside macros before.
2021-05-31 08:01:09 -07:00
Kartik K. Agaram
e9d2f00edb multi-macroexpanding backquote != nested backquote
This was quite difficult to diagnose. The issue I noticed was that brline
had stopped working. All the bugs in previous commits were hiding the cause.
Once I cleaned them up, I realized the problem was that the `(,x0 ,y0)
was triggering the nested-backquote check. The fix was fairly straightforward
then (even though I didn't yet understand why). But how to write a test
for this? I spent some time trying to do so without defining a macro using
literal macros, before I realized:

  You can't call literal macros; we don't have first-class macros.

Trying to insert literal macro support just breaks everything because we
have no way to distinguish between a literal macro call and the stage in
macroexpand where a symbol has been replaced with its macro definition.

How do you explain stuff like this? I grow weary of Lisp.

There's still some issue in loading the entire definition of brline from
data.limg.
2021-05-31 08:00:26 -07:00
Kartik K. Agaram
f691782d11 clean up a few things in macro tests 2021-05-31 07:24:51 -07:00
Kartik K. Agaram
af6fc79959 . 2021-05-30 21:52:31 -07:00
Kartik K. Agaram
64d3e8e2e0 . 2021-05-19 23:32:16 -07:00
Kartik K. Agaram
e2ab1b30b1 disallow null traces
We now use traces everywhere for error-checking. Null traces introduce
the possibility of changing a functions error response, and therefore its
semantics.
2021-05-19 20:56:37 -07:00
Kartik K. Agaram
91b7b0be73 shell: clean up trace for macroexpand 2021-05-18 20:01:11 -07:00
Kartik K. Agaram
61a68452ae all apps working again after null get check 2021-05-07 20:40:42 -07:00
Kartik K. Agaram
7105b73fd3 give up on nested backquotes for now 2021-05-07 09:22:54 -07:00
Kartik K. Agaram
f791cd9da9 macros almost done
Just one case left: macros within unquote.
2021-05-06 22:09:30 -07:00
Kartik K. Agaram
57fd40d500 some more cases 2021-05-06 21:41:03 -07:00
Kartik K. Agaram
a1cfadc749 first passing test for macroexpand
In the process I spent a long time tracking down a stray TODO in 108write.subx
that I thought would abort but didn't since the switch to baremetal.

Then after I reintroduced that assertion I had to go track down a bunch
of buffer sizes. Stream sizes continue to be a huge mess.
2021-05-06 21:38:02 -07:00
Kartik K. Agaram
edae464db5 shell: macroexpand outermost call 2021-05-06 18:13:27 -07:00
Kartik K. Agaram
6df53d463c back to macros; switch macroexpand to operate in place 2021-05-06 17:00:18 -07:00
Kartik K. Agaram
5e0f459848 . 2021-05-04 20:09:07 -07:00
Kartik K. Agaram
9156823c5d shell: start implementing macros 2021-05-04 19:49:21 -07:00