| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've been saying for a while[1][2][3] that adding extra abstractions makes
things harder for newcomers, and adding new notations doubly so. And then
I notice this DSL in my own backyard. Makes me feel like a hypocrite.
[1] https://news.ycombinator.com/item?id=13565743#13570092
[2] https://lobste.rs/s/to8wpr/configuration_files_are_canary_warning
[3] https://lobste.rs/s/mdmcdi/little_languages_by_jon_bentley_1986#c_3miuf2
The implementation of the DSL was also highly hacky:
a) It was happening in the tangle/ tool, but was utterly unrelated to tangling
layers.
b) There were several persnickety constraints on the different kinds of
lines and the specific order they were expected in. I kept finding bugs
where the translator would silently do the wrong thing. Or the error messages
sucked, and readers may be stuck looking at the generated code to figure
out what happened. Fixing error messages would require a lot more code,
which is one of my arguments against DSLs in the first place: they may
be easy to implement, but they're hard to design to go with the grain of
the underlying platform. They require lots of iteration. Is that effort
worth prioritizing in this project?
On the other hand, the DSL did make at least some readers' life easier,
the ones who weren't immediately put off by having to learn a strange syntax.
There were fewer quotes to parse, fewer backslash escapes.
Anyway, since there are also people who dislike having to put up with strange
syntaxes, we'll call that consideration a wash and tear this DSL out.
---
This commit was sheer drudgery. Hopefully it won't need to be redone with
a new DSL because I grow sick of backslashes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've extracted it into a separate binary, independent of my Mu prototype.
I also cleaned up my tracing layer to be a little nicer. Major improvements:
- Realized that incremental tracing really ought to be the default.
And to minimize printing traces to screen.
- Finally figured out how to combine layers and call stack frames in a
single dimension of depth. The answer: optimize for the experience of
`browse_trace`. Instructions occupy a range of depths based on their call
stack frame, and minor details of an instruction lie one level deeper
in each case.
Other than that, I spent some time adjusting levels everywhere to make
`browse_trace` useful.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up the rat's nest that all my trace management globals had
gradually turned into.
a) Get rid of 'Start_tracing'. Horryibly named, I don't know how I
missed that until now.
b) Never use START_TRACING_UNTIL_END_OF_SCOPE in main(). It's
confusing to combine it with atexit(delete Trace_stream), because the
atexit() never has to run. Instead we'll just manually initialize
Trace_stream and let atexit() clean up.
c) If we run tests we only want a trace for the test run itself. So
delete the Trace_stream that was initialized at the top of main --
once it's clear we had no load-time errors.
d) Clean up horribly "Load Recipes" waypoints, combine them with the better
name, "Mu Prelude".
Putting these together, we have the following manual tests:
- CFLAGS=-g mu x.mu
Should not create last_run.
- CFLAGS=-g mu --trace x.mu
Should create last_run.
Should write it out exactly once.
- CFLAGS=-g mu --trace x.mu # when x.mu has an error
Should create last_run.
Should write it out exactly once.
- CFLAGS=-g mu --trace test copy_literal # C test
Should create last_run.
Should write it out exactly once.
- CFLAGS=-g mu --trace test recipe_with_header # Mu test
Should create last_run.
Should write it out exactly once.
I don't know how to automate these scenarios yet. We need a way to run
our build toolchain atop our stack.
|
|
|
|
|
| |
Use 'dump' consistently to mean 'to screen' (stderr), and 'save' to mean
'to disk'.
|
|
|
|
| |
Audit poor uses of 'cout'.
|
|
|
|
| |
Drop a stray hunk that is obsoleted by 'deaddress'.
|
|
|
|
| |
This has taken me almost 6 weeks :(
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've been working on this slowly over several weeks, but it's too hard
to support 0 as the null value for addresses. I constantly have to add
exceptions for scalar value corresponding to an address type (now
occupying 2 locations). The final straw is the test for 'reload':
x:num <- reload text
'reload' returns an address. But there's no way to know that for
arbitrary instructions.
New plan: let's put this off for a bit and first create support for
literals. Then use 'null' instead of '0' for addresses everywhere. Then
it'll be easy to just change what 'null' means.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Surprisingly small change, considering how long it took me and how
mind-bending it was. 'return-continuation-until-mark' now behaves like
both call and return instructions, which made it hard to reason about.
|
|
|
|
|
| |
Stop hardcoding Max_depth everywhere; we had a default value for a
reason but then we forgot all about it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up how we reclaim local scopes.
It used to work like this (commit 3216):
1. Update refcounts of products after every instruction, EXCEPT:
a) when instruction is a non-primitive and the callee starts with
'local-scope' (because it's already not decremented in 'return')
OR:
b) when instruction is primitive 'next-ingredient' or
'next-ingredient-without-typechecking', and its result is saved to a
variable in the default space (because it's already incremented at
the time of the call)
2. If a function starts with 'local-scope', force it to be reclaimed
before each return. However, since locals may be returned, *very
carefully* don't reclaim those. (See the logic in the old `escaping`
and `should_update_refcount` functions.)
However, this approach had issues. We needed two separate commands for
'local-scope' (reclaim locals on exit) and 'new-default-space'
(programmer takes charge of reclaiming locals). The hard-coded
reclamation duplicated refcounting logic. In addition to adding
complexity, this implementation failed to work if a function overwrites
default-space after setting up a local-scope (the old default-space is
leaked). It also fails in the presence of continuations. Calling a
continuation more than once was guaranteed to corrupt memory (commit
3986).
After this commit, reclaiming local scopes now works like this:
Update refcounts of products for every PRIMITIVE instruction.
For non-primitive instructions, all the work happens in the `return`
instruction:
increment refcount of ingredients to `return`
(unless -- one last bit of ugliness -- they aren't saved in the
caller)
decrement the refcount of the default-space
use existing infrastructure for reclaiming as necessary
if reclaiming default-space, first decrement refcount of each
local
again, use existing infrastructure for reclaiming as necessary
This commit (finally!) completes the bulk[1] of step 2 of the plan in
commit 3991. It was very hard until I gave up trying to tweak the
existing implementation and just test-drove layer 43 from scratch.
[1] There's still potential for memory corruption if we abuse
`default-space`. I should probably try to add warnings about that at
some point (todo in layer 45).
|
| |
|
| |
|
|
|
|
|
|
| |
Instead of setup() and teardown() we'll just use a reset() function from
now on, which will bring the machine back to a good state before each
test or run, and also before exit (to avoid memory leaks).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Yet another attempt at decomposing incremental edits in some clean way.
The new idea now is that I need to only modify the screen using a
restricted vocabulary of actions:
render-all
render-recipe-side
render-sandbox-side
render-recipe-errors
render-line-from-cursor
render-line-from-start
erase-line-from-cursor
render-character-at-cursor
erase-character-at-cursor
However, decomposing insert-at-cursor is challenging; how to manipulate
cursor-row and cursor-column without also pretending to print to screen?
Do I need to decompose `editor` into multiple containers so that I can
keep cursor-row and cursor-column with screen modifications? Here's what
`editor` looks like after all layers:
container editor [
data:&:duplex-list:char
top-of-screen:&:duplex-list:char
bottom-of-screen:&:duplex-list:char
before-cursor:&:duplex-list:char
left:num
right:num
bottom:num
cursor-row:num
cursor-column:num
indent?:bool
undo:&:list:&:operation
redo:&:list:&:operation
]
It's not obvious that there's a clean way to split all these fields.
|
|
|
|
| |
Time to make my ad hoc commented out code fragments a first-class feature.
|
|
|
|
|
|
|
|
|
|
| |
It's always confusing when `break` refers to a `switch` but `continue`
refers to the loop around the `switch`. But we've done ugly things like
this and `goto` for expedience. However, we're starting to run into cases
where we now need to insert code at every `continue` or `continue`-mimicking
`goto` inside the core interpreter loop. Better to make the loop single-entry-single-exit.
Common things to run after every instruction will now happen inside the
`finish_instruction` function rather than at the `finish_instruction` label.
|
| |
|
|
|
|
| |
Starting to look for lack of organization in the edit/ app.
|
|
|
|
|
| |
Use the real original instruction in error messages.
Thanks Ella Couch.
|
|
|
|
| |
Fix CI.
|
|
|
|
|
|
|
| |
Yet another attempt at trying to clean up commit 3216. I think this solution
might finally let me stop agonizing over the problem. State variables for
distinguishing call-sites are a reasonable mechanism, orthogonal to waypoints
and the hook functions to hold them.
|
|
|
|
|
|
| |
Initial baby steps at trying to understand why rendering to screen is so
slow in Mu. I'd forgotten about this old "poor man's profiler" I'd added
back in 2015.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Be more disciplined about tagging 2 different concepts in the codebase:
a) Use the phrase "later layers" to highlight places where a layer
doesn't have the simplest possible self-contained implementation.
b) Use the word "hook" to point out functions that exist purely to
provide waypoints for extension by future layers.
Since both these only make sense in the pre-tangled representation of
the codebase, using '//:' and '#:' comments to get them stripped out of
tangled output.
(Though '#:' comments still make it to tangled output at the moment.
Let's see if we use it enough to be worth supporting. Scenarios are
pretty unreadable in tangled output anyway.)
|
|
|
|
| |
Gracefully handle yet another typo.
|
|
|
|
|
| |
Clean up the flow of "mu --trace" followed by "mu browse-trace
interactive".
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Don't crash on bad types.
I need to be more careful in distinguishing between the two causes of
constraint violations: bad input and internal bugs. Maybe I should
create a second assert() to indicate "this shouldn't really be an
assert, but I'm too lazy to think about it right now."
|
|
|
|
|
| |
size_of(type_tree*) is a mess; clean it up with an eye to the final
tangled version.
|
|
|
|
|
| |
Standardize on calling literate waypoints "Special-cases" rather than
"Cases". Invariably there's a default path already present.
|
|
|
|
|
|
|
|
| |
To do so, run:
$ ./mu --trace test <scenario name>
The trace will then be in file 'interactive'.
|
|
|
|
| |
Fix CI.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Better warning if I try:
mu test --test-only-app sandbox
instead of:
mu --test-only-app test sandbox
|
| |
|
|
|
|
|
| |
One more place we were missing expanding type abbreviations: inside
container definitions.
|
| |
|