about summary refs log tree commit diff stats
path: root/020run.cc
Commit message (Collapse)AuthorAgeFilesLines
* 5001 - drop the :(scenario) DSLKartik Agaram2019-03-121-74/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 4987 - support `browse_trace` tool in SubXKartik Agaram2019-02-251-8/+25
| | | | | | | | | | | | | | | | | | 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.
* 4421Kartik Agaram2018-07-261-36/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 4418Kartik Agaram2018-07-261-4/+4
| | | | | Use 'dump' consistently to mean 'to screen' (stderr), and 'save' to mean 'to disk'.
* 4417Kartik Agaram2018-07-261-1/+1
| | | | Audit poor uses of 'cout'.
* 4267Kartik Agaram2018-06-241-4/+0
| | | | Drop a stray hunk that is obsoleted by 'deaddress'.
* 4266 - space for alloc-id in heap allocationsKartik Agaram2018-06-241-1/+38
| | | | This has taken me almost 6 weeks :(
* 4258 - undo 4257Kartik Agaram2018-06-151-11/+3
|
* 4257 - abortive attempt at safe fat pointersKartik Agaram2018-06-151-3/+11
| | | | | | | | | | | | | | | | 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.
* 4243Kartik Agaram2018-05-121-1/+1
|
* 4204Kartik K. Agaram2018-02-151-1/+10
|
* 4149Kartik K. Agaram2017-12-071-1/+4
|
* 4147Kartik K. Agaram2017-12-071-2/+6
|
* 4140Kartik K. Agaram2017-12-051-1/+1
|
* 4139Kartik K. Agaram2017-12-051-7/+5
|
* 4116 - support calling continuations with argumentsKartik K. Agaram2017-11-061-0/+2
| | | | | | 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.
* 4104Kartik K. Agaram2017-11-031-2/+2
| | | | | Stop hardcoding Max_depth everywhere; we had a default value for a reason but then we forgot all about it.
* 4089Kartik K. Agaram2017-10-221-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* 3987Kartik K. Agaram2017-09-011-1/+1
|
* 3966Kartik K. Agaram2017-07-091-1/+1
|
* 3965 - get rid of the teardown() functionKartik K. Agaram2017-07-091-2/+1
| | | | | | 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).
* 3906Kartik K. Agaram2017-06-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 3888 - beginnings of a profilerKartik K. Agaram2017-05-281-21/+48
| | | | Time to make my ad hoc commented out code fragments a first-class feature.
* 3887 - clean up early exits in interpreter loopKartik K. Agaram2017-05-281-10/+18
| | | | | | | | | | 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.
* 3877Kartik K. Agaram2017-05-261-3/+3
|
* 3872Kartik K. Agaram2017-05-201-0/+1
| | | | Starting to look for lack of organization in the edit/ app.
* 3841Kartik K. Agaram2017-04-271-3/+3
| | | | | Use the real original instruction in error messages. Thanks Ella Couch.
* 3821Kartik K. Agaram2017-04-131-0/+1
| | | | Fix CI.
* 3819Kartik K. Agaram2017-04-131-2/+5
| | | | | | | 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.
* 3814Kartik K. Agaram2017-04-061-0/+1
| | | | | | 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.
* 3811Kartik K. Agaram2017-04-041-1/+1
|
* 3758Kartik K. Agaram2017-03-061-0/+1
|
* 3756 - start of some improvements to the trace browserKartik K. Agaram2017-03-051-1/+1
|
* 3707Kartik K. Agaram2016-12-121-3/+9
| | | | | | | | | | | | | | | | | | 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.)
* 3701Kartik K. Agaram2016-11-291-0/+1
| | | | Gracefully handle yet another typo.
* 3682Kartik K. Agaram2016-11-221-3/+5
| | | | | Clean up the flow of "mu --trace" followed by "mu browse-trace interactive".
* 3675Kartik K. Agaram2016-11-151-2/+2
|
* 3655Kartik K. Agaram2016-11-081-1/+1
|
* 3653Kartik K. Agaram2016-11-081-1/+4
| | | | | | | | | 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."
* 3652Kartik K. Agaram2016-11-081-0/+10
| | | | | size_of(type_tree*) is a mess; clean it up with an eye to the final tangled version.
* 3643Kartik K. Agaram2016-11-071-3/+3
| | | | | Standardize on calling literate waypoints "Special-cases" rather than "Cases". Invariably there's a default path already present.
* 3630 - generate trace for a single scenarioKartik K. Agaram2016-11-061-3/+3
| | | | | | | | To do so, run: $ ./mu --trace test <scenario name> The trace will then be in file 'interactive'.
* 3596Kartik K. Agaram2016-10-251-0/+3
| | | | Fix CI.
* 3561Kartik K. Agaram2016-10-221-4/+4
|
* 3555Kartik K. Agaram2016-10-221-1/+1
|
* 3522Kartik K. Agaram2016-10-191-9/+9
|
* 3446Kartik K. Agaram2016-10-061-1/+3
| | | | | | | | | | Better warning if I try: mu test --test-only-app sandbox instead of: mu --test-only-app test sandbox
* 3435Kartik K. Agaram2016-10-041-0/+3
|
* 3380Kartik K. Agaram2016-09-171-11/+11
| | | | | One more place we were missing expanding type abbreviations: inside container definitions.
* 3358Kartik K. Agaram2016-09-151-0/+4
|