about summary refs log tree commit diff stats
path: root/062convert_ingredients_to_text.cc
Commit message (Collapse)AuthorAgeFilesLines
* 5001 - drop the :(scenario) DSLKartik Agaram2019-03-121-68/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | | | | | | | | | 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.
* 4265Kartik Agaram2018-06-171-1/+1
| | | | Standardize use of type ingredients some more.
* 4106Kartik K. Agaram2017-11-031-1/+1
|
* 4089Kartik K. Agaram2017-10-221-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* 3747Kartik K. Agaram2017-02-071-1/+1
|
* 3744Kartik K. Agaram2017-02-071-2/+2
| | | | | | Undo 3743. Really any time we create new instructions from whole cloth during rewriting or transform, the whole notion of 'original name' goes out the window. Pointless trying to fight that fact of life.
* 3743Kartik K. Agaram2017-02-071-2/+2
| | | | | | | | One way to ensure we always set old_name is to create a method to initialize names as opposed to just assigning them. Still not ideal because we still assign directly most of the time, so it's easy to forget.
* 3692Kartik K. Agaram2016-11-251-1/+1
| | | | | | If we're automatically passing ingredients to 'append' through 'to-text' if its first ingredient is text, we don't need to pass that first ingredient itself through 'to-text'.
* 3555Kartik K. Agaram2016-10-221-1/+1
|
* 3553Kartik K. Agaram2016-10-221-1/+1
| | | | | | | Tag all transforms as idempotent or not. I'd fallen off this wagon. I might even be getting it wrong. Something a type system should automatically verify.
* 3522Kartik K. Agaram2016-10-191-4/+4
|
* 3520Kartik K. Agaram2016-10-181-1/+0
| | | | | | | | Drop a few debug prints. Hopefully now we need never duplicate trace statements and can instead just dump them to screen. I'll soon need the ability to selectively dump traces for a specific label.
* 3390Kartik K. Agaram2016-09-171-2/+2
|
* 3389Kartik K. Agaram2016-09-171-1/+1
|
* 3385Kartik K. Agaram2016-09-171-8/+8
|
* 3381Kartik K. Agaram2016-09-171-1/+1
|
* 3374Kartik K. Agaram2016-09-161-4/+4
|
* 3368Kartik K. Agaram2016-09-151-2/+4
| | | | Decouple layer 61 test from layer 62 dependency.
* 3365 - create strings out of arbitrary typesKartik K. Agaram2016-09-151-2/+27
| | | | | The implementation is quite hacky. Let's see how future needs develop before we try to clean it up.
* 3364Kartik K. Agaram2016-09-151-6/+6
|
* 3359Kartik K. Agaram2016-09-151-0/+145