Commit Graph

547 Commits

Author SHA1 Message Date
Kartik K. Agaram
14f00ab369 . 2021-06-11 17:34:45 -07:00
Kartik K. Agaram
6cc2cd6cb5 . 2021-06-11 17:32:22 -07:00
Kartik K. Agaram
d5ae556a0c . 2021-06-11 17:31:29 -07:00
Kartik K. Agaram
9487b2dde7 . 2021-06-11 17:19:48 -07:00
Kartik K. Agaram
f8c5b63cb9 . 2021-06-11 17:17:13 -07:00
Kartik K. Agaram
c29a10ac37 .
Inline a function by patching a few variable names. I don't even have to
worry about `return` statements if there's a single call and it's in tail
position in the caller.
2021-06-11 15:37:03 -07:00
Kartik K. Agaram
cc679f4234 . 2021-06-11 15:34:02 -07:00
Kartik K. Agaram
995ff89c8e start showing parse errors under definitions
We don't have support for browsing them yet. Just errors for now, which
should only be a line or two. Larger traces might be useful for inspecting
results of macroexpansion.
2021-06-11 11:32:27 -07:00
Kartik K. Agaram
0b055331bc . 2021-06-11 11:24:49 -07:00
Kartik K. Agaram
f6808302e5 . 2021-06-11 11:16:26 -07:00
Kartik K. Agaram
3e32a1b808 . 2021-06-09 21:52:07 -07:00
Kartik K. Agaram
eb8260b227 . 2021-06-09 21:38:30 -07:00
Kartik K. Agaram
a2d4e41583 . 2021-06-09 21:28:45 -07:00
Kartik K. Agaram
117229ae17 . 2021-06-09 21:21:47 -07:00
Kartik K. Agaram
be9fa3780a .
Add argument to a few functions.
2021-06-09 21:05:29 -07:00
Kartik K. Agaram
0aed24e222 . 2021-06-09 20:50:19 -07:00
Kartik K. Agaram
6169ec59c0 make tests pass again
I'm temporarily disabling the pending state. I'm also providing a clearer
error message when we encounter the bug.
2021-06-09 16:05:09 -07:00
Kartik K. Agaram
b7e8c2810a snapshot: attempt at modifying a function name
It turns out there's another problem, and it predates the ability to create
new definitions:

  ctrl-s triggers a call to `evaluate`, which inserts a new definition
  into globals. which has a null gap buffer.

All this happens long before the new code in this commit, resulting in a
null gap buffer by the time we get to word-at-cursor.

Which in turn happens because we perform a raw `evaluate`, which doesn't
update the gap buffer like `run` does (using `maybe-stash-gap-buffer-to-global`).

And arguably `evaluate` shouldn't mess with the gap buffer. Gap buffers
are a UI concern.

The hardest version of this immediate scenario: It's unclear how to guarantee
that every definition have a gap buffer, when two definitions may share
one (closures sharing a lexical environment).

New plan:
  - improve the logic for detecting definitions. Looking at the outermost
    layer isn't enough. And a single expression can create multiple definitions.
  - extract a helper to attach a single gap buffer to multiple definitions.
  - have the UI detect conflicts in gap buffers and prompt the user for
    a decision if a different gap buffer already exists for a definition.
2021-06-09 09:16:52 -07:00
Kartik K. Agaram
d0d8fc7b04 . 2021-06-08 21:25:58 -07:00
Kartik K. Agaram
206493b5e1 . 2021-06-08 21:09:05 -07:00
Kartik K. Agaram
139620e3d2 shell: function modal now also creates functions 2021-06-08 20:47:07 -07:00
Kartik K. Agaram
e375f0104c shell: expand set of possible errors
Requires a change to mu.subx, to unify literal strings with generic
  (addr array _)
2021-06-08 20:21:39 -07:00
Kartik K. Agaram
d2f2ac59b6 . 2021-06-08 19:33:51 -07:00
Kartik K. Agaram
0b56336ba8 a place for error messages in the function modal
Probably not ideal, but it's a start.
2021-06-08 19:28:34 -07:00
Kartik K. Agaram
de013be794 ok, function modal now has full coverage 2021-06-08 18:09:17 -07:00
Kartik K. Agaram
25803914b3 . 2021-06-08 17:01:56 -07:00
Kartik K. Agaram
9b13d8858a first test for function modal 2021-06-08 16:47:23 -07:00
Kartik K. Agaram
1150170da0 . 2021-06-08 16:31:20 -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
227d18f8a2 shell: first test for entire environment
This introduces some ergonomic issues. But we have to start somewhere.
2021-06-08 11:57:03 -07:00
Kartik K. Agaram
9d2c64455a fizz-buzz take 2 2021-06-06 23:22:57 -07:00
Kartik K. Agaram
4ec95d54ce reverse-video for cursor 2021-06-06 23:08:40 -07:00
Kartik K. Agaram
c546987a07 fizz-buzz exercise 2021-06-06 22:53:46 -07:00
Kartik K. Agaram
b6e1cffd9b shell: concept of palettes 2021-06-06 22:38:56 -07:00
Kartik K. Agaram
32487eb00c growing disenamored with up and down 2021-06-06 22:25:07 -07:00
Kartik K. Agaram
3efbe5bf56 . 2021-06-06 22:14:24 -07:00
Kartik K. Agaram
9922e558a3 handle navigating to a non-existent function
We need a place to show error messages. Maybe on the top row?
2021-06-06 21:46:42 -07:00
Kartik Agaram
e941dd505c . 2021-06-06 19:03:41 -07:00
Kartik K. Agaram
9fd3111ea9 shell: more foundations from Lisp 2021-06-06 16:41:37 -07:00
Kartik K. Agaram
f79ae9ea54 . 2021-06-06 16:40:35 -07:00
Kartik K. Agaram
86f9744257 . 2021-06-06 16:39:07 -07:00
Kartik K. Agaram
c1fff5ec14 shell: fleshing out the 'standard library'
Based loosely on Arc's arc.arc:
  http://arclanguage.org
  https://github.com/arclanguage/anarki/blob/official/arc.arc
2021-06-06 12:55:06 -07:00
Kartik K. Agaram
44c53fa572 . 2021-06-06 12:50:25 -07:00
Kartik K. Agaram
8014210316 shell: support negative integer literals
We still don't support _any_ fractional literals, positive or negative.
2021-06-06 12:39:03 -07:00
Kartik K. Agaram
3bdf3b1a7f shell: remainder operation 2021-06-06 12:11:14 -07:00
Kartik K. Agaram
d555a71cb3 . 2021-06-06 11:53:25 -07:00
Kartik K. Agaram
c4cf38773f more space for definitions 2021-06-06 10:54:50 -07:00
Kartik K. Agaram
b5d3095c92 shell: cool new stress-test 2021-06-05 23:12:13 -07:00
Kartik K. Agaram
79a80f7774 . 2021-06-05 23:12:13 -07:00
Kartik K. Agaram
6d67e1bf14 . 2021-06-05 20:50:06 -07:00
Kartik K. Agaram
0b3d456f2c clean up a large memory leak
It turns out (bowboard screen 128) on a real screen massively slowed down
and ran out of memory since commit e2ab1b30b1 on May 19. The culprit was
these changes, which created memory allocations for a new trace on every
recursive call.

I originally had some vague desire to isolate these calls from the user-visible
trace. That's expensive enough that I'll wait until it becomes a concern
before trying to isolate again.
2021-06-05 20:43:39 -07:00
Kartik K. Agaram
b012fba1bc . 2021-06-05 18:04:05 -07:00
Kartik K. Agaram
3ac99829c7 shell: moar macros 2021-06-05 17:49:03 -07:00
Kartik K. Agaram
f3ee7be683 . 2021-06-05 17:39:56 -07:00
Kartik K. Agaram
48522591f8 refresh edited definitions on ctrl-s 2021-06-05 11:56:13 -07:00
Kartik K. Agaram
99523f654f . 2021-06-05 10:02:44 -07:00
Kartik K. Agaram
6897177137 go-to dialog starts with word at cursor by default 2021-06-05 09:53:15 -07:00
Kartik K. Agaram
3d4e1b8b28 working on jumping to word at cursor
I had a nice clean definition for word-at-cursor, but it's wrong and I'm
going to have to mangle it.
2021-06-05 09:35:37 -07:00
Kartik K. Agaram
5a066f8dda start editing function definitions 2021-06-04 22:11:41 -07:00
Kartik K. Agaram
65e414911f run sandbox even when cursor in function 2021-06-04 22:05:51 -07:00
Kartik K. Agaram
4975bc82df bugfix: show functions after ctrl-g, enter 2021-06-04 22:05:02 -07:00
Kartik K. Agaram
7de9d457eb .
Menu when cursor is within a function.
2021-06-04 21:59:01 -07:00
Kartik K. Agaram
73bbe731c5 select function to render first 2021-06-04 21:56:43 -07:00
Kartik K. Agaram
7531bc2124 always render functions starting at the cursor
For now we just never render definitions above it. That will improve.
2021-06-04 21:48:35 -07:00
Kartik K. Agaram
11e8d83d61 record the definition the cursor is currently at 2021-06-04 21:48:29 -07:00
Kartik K. Agaram
2177b38a68 conditionally display cursor on function side
Always shows at top-most function.
Can't actually do any editing yet.
2021-06-04 21:47:59 -07:00
Kartik K. Agaram
1f05bdcc34 conditionally display cursor in sandbox 2021-06-04 21:47:53 -07:00
Kartik K. Agaram
d40dfea3ed modal dialog for function name to jump to 2021-06-04 21:47:36 -07:00
Kartik K. Agaram
846664c4dd . 2021-06-04 20:15:11 -07:00
Kartik K. Agaram
1aba9c6f8e . 2021-06-04 20:14:45 -07:00
Kartik K. Agaram
55001994ef .
Keyboard state machine for jumping to function definition.
2021-06-04 20:13:38 -07:00
Kartik K. Agaram
6f7846ebc4 .
Menu shortcut for jumping to function definition.
2021-06-04 20:13:13 -07:00
Kartik K. Agaram
f47051ae57 . 2021-06-04 20:08:29 -07:00
Kartik K. Agaram
cd4d0ae5b6 .
Keep hotkeys stable when different elements are in focus.
2021-06-04 20:07:10 -07:00
Kartik K. Agaram
81b3f72fb8 . 2021-06-04 19:58:20 -07:00
Kartik K. Agaram
eb6758c61f . 2021-06-04 19:41:27 -07:00
Kartik K. Agaram
30745be5b5 . 2021-06-04 19:41:05 -07:00
Kartik K. Agaram
84bc03ab39 . 2021-06-04 19:40:06 -07:00
Kartik K. Agaram
4dd08c268d . 2021-06-04 16:46:20 -07:00
Kartik K. Agaram
224e264a65 . 2021-06-04 16:43:19 -07:00
Kartik K. Agaram
cfb5dbce59 . 2021-06-04 16:41:18 -07:00
Kartik K. Agaram
e683a3fdee . 2021-06-04 16:39:05 -07:00
Kartik K. Agaram
380837ac2a more convenient 'def' 2021-06-04 16:12:30 -07:00
Kartik K. Agaram
bb1ccae27f rename the definition primitive to 'def' 2021-06-04 16:07:07 -07:00
Kartik K. Agaram
4bb826b40e . 2021-06-03 20:55:42 -07:00
Kartik K. Agaram
1c6b965a7f starting to support function editing 2021-06-03 20:49:24 -07:00
Kartik K. Agaram
d00f8dc6ca . 2021-06-03 20:37:51 -07:00
Kartik K. Agaram
3ef69a05b0 . 2021-06-03 20:29:37 -07:00
Kartik K. Agaram
6b34a1c9bf . 2021-06-03 14:55:33 -07:00
Kartik K. Agaram
b9ad848cff . 2021-06-03 14:49:49 -07:00
Kartik K. Agaram
63cd30d806 . 2021-06-03 14:42:07 -07:00
Kartik K. Agaram
9446e7e594 .
Drop some low-entropy trace lines.
2021-06-03 00:03:20 -07:00
Kartik K. Agaram
bd49d5c35c shell: more stable trace when rerunning 2021-06-02 23:57:23 -07:00
Kartik K. Agaram
60872b2b77 . 2021-06-02 23:36:34 -07:00
Kartik Agaram
35336a5f64 .
State as of https://archive.org/details/akkartik-mu-2021-05-31
2021-05-31 23:13:10 -07:00
Kartik Agaram
ccadba5b95 .
Until we get scrolling on functions, it's a little cleaner to draw the
primitives on top.
2021-05-31 20:40:08 -07:00
Kartik K. Agaram
7640a77c5f interrupt repl on keypress 2021-05-31 15:18:25 -07:00
Kartik K. Agaram
0c0541d709 . 2021-05-31 15:18:25 -07:00
Kartik K. Agaram
ee536ff3e8 . 2021-05-31 15:18:25 -07:00
Kartik K. Agaram
e3c7445330 clean up trace depth in a few places
It turns out the problem was that `and` wasn't cleaning up after itself
when it short-circuited evaluation. Similar problems in a couple more places.
2021-05-31 10:38:39 -07:00
Kartik K. Agaram
940401ff9e . 2021-05-31 10:19:38 -07:00
Kartik K. Agaram
0ea329da1f bugfix for disappearing trace
It turns out I have a problem with trace depth somewhere which I just wasn't
noticing before. Running certain sandboxes (line; maybe loops?) twice was
causing traces to no longer start at depth 1, which implies that they weren't
terminating at depth 1. This became a lot more obvious since I instituted
a max-depth.
2021-05-31 10:14:09 -07:00
Kartik K. Agaram
650f417de2 . 2021-05-31 08:59:09 -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
35e0613849 shell: raise errors when loading code on boot 2021-05-30 19:12:20 -07:00
Kartik K. Agaram
067fa9c725 bugfix: unbound variables were not raising error
Since we switched error trace semantics from a designated label to a designated
depth (commit 9831a8cef9 on May 19).
2021-05-30 18:02:40 -07:00
Kartik K. Agaram
961ce67569 . 2021-05-30 17:20:42 -07:00
Kartik K. Agaram
4cc603deeb unconditionally trace errors
Now that we never have a null trace, tracing errors is always safe. And
now that we're running with low trace max-depth we're more likely to run
into problems with missing errors in the trace.
2021-05-30 17:15:21 -07:00
Kartik K. Agaram
b699982fb4 . 2021-05-30 16:45:38 -07:00
Kartik K. Agaram
40c6066324 . 2021-05-30 16:41:38 -07:00
Kartik K. Agaram
cde14438e0 first test re-running sandbox with a deeper trace 2021-05-30 16:38:20 -07:00
Kartik K. Agaram
46009cd1bb . 2021-05-30 10:13:53 -07:00
Kartik K. Agaram
158b53eb8f first attempt doesn't work
I was aware of some complications. The various indexes and y coordinates
in the trace's cache would be unstable and need to be recomputed. But it's
surprising that the trace _completely disappears_.
2021-05-30 09:23:36 -07:00
Kartik K. Agaram
1496548287 start progressively increasing trace depth
The goal: the sandbox initially maintains a shallow trace. As you expand
into the trace, the environment reruns the sandbox at greater depth as
needed.

The challenge: expanding happens within edit-trace, which doesn't have
the whole sandbox needed to re-run the sandbox. We'll either need to expand
the trace's capabilities to include the whole sandbox, or duplicate some
logic to decide when to run the sandbox.
2021-05-30 08:51:58 -07:00
Kartik K. Agaram
9062eeb554 . 2021-05-29 21:45:33 -07:00
Kartik K. Agaram
10e41d00d8 . 2021-05-29 21:39:18 -07:00
Kartik K. Agaram
1eb74e2d5d shell: scrolling the trace 2021-05-29 20:52:57 -07:00
Kartik K. Agaram
9516dfa0b0 shell: skeleton for scrolling 2021-05-29 17:23:04 -07:00
Kartik K. Agaram
d85529f3fa cache visibility for all lines in trace
So far we were only doing so for the first few lines, just enough to render
one page's worth of lines. We'd have probably noticed if we collapsed some
lines after re-evaluating.
2021-05-29 17:13:06 -07:00
Kartik K. Agaram
fde296ca3c . 2021-05-29 17:03:22 -07:00
Kartik K. Agaram
58c801db0f . 2021-05-29 16:49:36 -07:00
Kartik K. Agaram
af46771821 . 2021-05-29 16:42:15 -07:00
Kartik K. Agaram
91ddc3a82d . 2021-05-29 16:41:47 -07:00
Kartik K. Agaram
c8b2424f45 shell: start implementing scrolling in the trace
I've been stymied for a week wondering how to reliably compute trace-line
identity. A trace can have multiple identical lines. Only some of them
may be visible at any point. How to remember which is which across re-evaluations?

There's no easy answer. I'm just going to keep things ad hoc. When you
re-evaluate, new lines can currently pop into visibility. However we guarantee
that just moving around the trace will be stable, thanks to the visible
bit being cached within each trace-line. Scrolling will be similar. Reevaluating
may cause the trace to be perturbed up or down. However, just scrolling
around will work reliably.
2021-05-29 16:37:32 -07:00
Kartik K. Agaram
4de6f80334 . 2021-05-29 16:25:38 -07:00
Kartik K. Agaram
9b131ce02b . 2021-05-29 16:22:08 -07:00
Kartik K. Agaram
7b84872380 shell: non-stream tokens are now small 2021-05-29 16:07:39 -07:00
Kartik K. Agaram
0bba6ccfc2 . 2021-05-29 16:04:30 -07:00
Kartik K. Agaram
aceb526b50 . 2021-05-29 16:01:50 -07:00
Kartik K. Agaram
c2e59bbf9d . 2021-05-29 16:00:59 -07:00
Kartik K. Agaram
6b212ed6e7 . 2021-05-29 15:54:41 -07:00
Kartik K. Agaram
d8f306c30c . 2021-05-29 15:53:31 -07:00
Kartik K. Agaram
2ad0a98f94 . 2021-05-29 15:53:21 -07:00
Kartik K. Agaram
56c621b6f1 shell: start reducing the waste in tokenize 2021-05-29 15:49:58 -07:00
Kartik K. Agaram
210553ac68 .
slightly improve colors
2021-05-23 22:53:54 -07:00
Kartik K. Agaram
bda55a3eec ctrl-s in trace: show entire current line 2021-05-23 22:47:40 -07:00
Kartik K. Agaram
f32e8035c7 . 2021-05-23 22:26:49 -07:00
Kartik K. Agaram
7fa0163941 disable ctrl-s when browsing trace
We're soon going to be dynamically rerunning the sandbox in other ways
when browsing the trace.
2021-05-23 22:18:51 -07:00
Kartik K. Agaram
d3103378c5 . 2021-05-23 22:17:05 -07:00
Kartik K. Agaram
d474128db1 shrink trace menu 2021-05-23 22:07:50 -07:00
Kartik K. Agaram
b2dd7e6a91 start truncating trace lines 2021-05-23 22:04:31 -07:00
Kartik K. Agaram
7a04c8104d shell: reduce trace depth in sandbox
We'll gradually make this more dynamic.
2021-05-22 10:28:21 -07:00
Kartik K. Agaram
6934f78e97 . 2021-05-22 09:30:11 -07:00
Kartik K. Agaram
64d3e8e2e0 . 2021-05-19 23:32:16 -07:00
Kartik K. Agaram
119e661f20 a second place with lousy storage management 2021-05-19 23:23:49 -07:00
Kartik K. Agaram
4b57c101b7 more robust print-cell
It is used to print to the trace, and we shouldn't crash the whole computer
just because the trace ran out of space.
2021-05-19 23:14:27 -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
6bbeadecaa . 2021-05-19 19:55:29 -07:00
Kartik K. Agaram
f8c28e3a36 . 2021-05-19 17:30:25 -07:00
Kartik K. Agaram
831e2e0d64 . 2021-05-19 17:29:17 -07:00
Kartik K. Agaram
ec2dab7801 shell: traces track a maximum depth to record 2021-05-19 01:26:25 -07:00
Kartik K. Agaram
9831a8cef9 shell: depth 0 as the check for errors 2021-05-19 01:21:02 -07:00
Kartik K. Agaram
3fc03a98e5 shell: start traces at depth 1 rather than 0
We're going to carve out depth 0 for errors.
2021-05-19 01:15:35 -07:00
Kartik K. Agaram
91b7b0be73 shell: clean up trace for macroexpand 2021-05-18 20:01:11 -07:00
Kartik K. Agaram
837926751a shell: add a lot of error-checking 2021-05-18 20:01:11 -07:00
Kartik K. Agaram
c4475d83b7 shell: roll back a change to the 'when' macro
Introduced in commit 1adc904ef3 from a week ago, but it turns out brcircle
has been consistently broken ever since.
2021-05-15 12:43:35 -07:00
Kartik K. Agaram
183010779c A 'bowboard', a chessboard of rainbow circles
Compare with (chessboard screen 256)
2021-05-08 08:33:22 -07:00
Kartik K. Agaram
665b1e8f07 a full-circle rainbow 2021-05-08 07:58:56 -07:00
Kartik K. Agaram
1adc904ef3 new shell macro: do 2021-05-07 21:13:24 -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
19dd573a92 . 2021-05-07 20:02:01 -07:00
Kartik K. Agaram
d3f17627d8 an often-overflowing stream when running brcircle
We really need to systematically check our trace streams.
2021-05-07 15:12:56 -07:00
Kartik K. Agaram
c5f50f05b7 . 2021-05-07 12:46:41 -07:00
Kartik K. Agaram
150db8d56a some boot-time heartbeat messages
This will help us with some common debug scenarios.
2021-05-07 12:27:20 -07:00
Kartik K. Agaram
dd192dd52c . 2021-05-07 12:11:59 -07:00
Kartik K. Agaram
e42ae8219e clean up all definitions 2021-05-07 12:08:07 -07:00
Kartik K. Agaram
d605ba1f9a clean up chessboard
We still benefit from some helpers here because of the unrolling and multiple
calls to helpers.
2021-05-07 11:56:43 -07:00
Kartik K. Agaram
d8298d1a2a clean up read_line 2021-05-07 11:37:48 -07:00
Kartik K. Agaram
91f76e6b22 clean up Bresenham line-drawing 2021-05-07 11:28:59 -07:00
Kartik K. Agaram
25eb9c580e . 2021-05-07 11:02:55 -07:00
Kartik K. Agaram
92fb55d50f no, we need hline1 for fill_rect 2021-05-07 10:14:51 -07:00
Kartik K. Agaram
c651bbeffc clean up hline and vline 2021-05-07 10:05:20 -07:00
Kartik K. Agaram
74be534e2b starting to implement first macros
Another commit, another bugfix.

Some snippets from my currently exploding todo list:

- always investigate lookup errors immediately. Beyond the root cause, they should never happen at the moment, while we aren't reclaiming memory.
  we should always return a more precise error message. Usually involving null pointer checks.

- on abort, print out stack trace
  - emit mapping of labels to addresses during survey
  - store a mapping of symbols somewhere in the code image

- stop allocating 1KB per token; expand space for tokens as needed
2021-05-07 09:49:16 -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
7c8ad5a419 more paranoia in shell/globals.mu 2021-05-06 19:38:54 -07:00
Kartik K. Agaram
edae464db5 shell: macroexpand outermost call 2021-05-06 18:13:27 -07:00
Kartik K. Agaram
1648a04cc0 literal macros
Current plan:
- some way to define macros. For now:
    (def f (litmac litfn () (a b) `(+ ,a , b)))
- macroexpand will expand calls by passing them through the cdr
    (f 3 4)
    macroexpand: ((litfn () (a b) `(+ ,a ,b)) 3 4)
      => (+ 3 4)
    eval: (+ 3 4) => 7
2021-05-06 17:29:51 -07:00
Kartik K. Agaram
e9981404da . 2021-05-06 17:27:17 -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
a54c6f2ee7 belatedly migrate stale example definitions
Also bare-bones syntax highlighting for .limg files. Doesn't work when
.limg file is first file opened with Vim.
2021-05-06 16:42:08 -07:00
Kartik K. Agaram
effbe423a7 . 2021-05-06 15:10:56 -07:00
Kartik K. Agaram
ba5f556543 . 2021-05-04 20:20:03 -07:00
Kartik K. Agaram
5e0f459848 . 2021-05-04 20:09:07 -07:00
Kartik K. Agaram
0069028dae . 2021-05-04 20:00:03 -07:00
Kartik K. Agaram
9156823c5d shell: start implementing macros 2021-05-04 19:49:21 -07:00
Kartik K. Agaram
7465fbb19f . 2021-05-04 19:46:49 -07:00
Kartik K. Agaram
66c18fda1d shell: unquote splice 2021-05-04 04:28:04 -07:00
Kartik K. Agaram
bb9f4e4e1d shell: unquote 2021-05-04 03:53:00 -07:00
Kartik K. Agaram
de94891356 shell: start evaluating backquote 2021-05-03 21:01:50 -07:00
Kartik K. Agaram
1c69a13a88 . 2021-05-03 20:31:57 -07:00
Kartik K. Agaram
a08658f218 . 2021-05-03 18:16:15 -07:00
Kartik K. Agaram
1048729a6e . 2021-05-03 17:31:19 -07:00
Kartik K. Agaram
93f1bee02c reading and printing backquotes and unquotes 2021-05-03 12:02:12 -07:00