Commit Graph

106 Commits

Author SHA1 Message Date
Kartik K. Agaram c0db806820 . 2021-07-19 19:46:04 -07:00
Kartik K. Agaram 542773df2f render functions in MRU order 2021-07-19 15:39:36 -07:00
Kartik K. Agaram b22e6ebfe2 . 2021-07-17 00:23:52 -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 70919b45f0 .
Rename cells containing screens to screen vars because of the ambiguity
that each grapheme in fake screens is represented by a type screen-cell.
While we're at it, we also analogously rename keyboard vars.
2021-06-12 15:16:50 -07:00
Kartik K. Agaram 3191861242 better name 2021-06-11 20:11:16 -07:00
Kartik K. Agaram cbf3de0f08 back to the pending test
I'm ready again to take on commit 6169ec59c after lots of refactoring.
2021-06-11 19:26:20 -07:00
Kartik K. Agaram 040b60bc6e .
Save a single trace to potentially multiple globals just like a gap buffer
(if say we have a single let binding defining multiple functions).

I don't have a strong use for this yet, but it seems cleaner. Maybe it's
redundant or wrong.
2021-06-11 19:17:08 -07:00
Kartik K. Agaram 6f64f5d3b6 . 2021-06-11 18:20:47 -07:00
Kartik K. Agaram c1e5ddfa54 . 2021-06-11 18:20:25 -07:00
Kartik K. Agaram 18c8e8c82f . 2021-06-11 17:54:04 -07:00
Kartik K. Agaram 4de136fb85 . 2021-06-11 17:50:34 -07:00
Kartik K. Agaram 6cc2cd6cb5 . 2021-06-11 17:32:22 -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 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 139620e3d2 shell: function modal now also creates functions 2021-06-08 20:47: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 48522591f8 refresh edited definitions on ctrl-s 2021-06-05 11:56:13 -07:00
Kartik K. Agaram 5a066f8dda start editing function definitions 2021-06-04 22:11:41 -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 81b3f72fb8 . 2021-06-04 19:58:20 -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 6b34a1c9bf . 2021-06-03 14:55:33 -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 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 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 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 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 7c8ad5a419 more paranoia in shell/globals.mu 2021-05-06 19:38:54 -07:00