about summary refs log tree commit diff stats
path: root/101run_sandboxed.cc
Commit message (Collapse)AuthorAgeFilesLines
* 5001 - drop the :(scenario) DSLKartik Agaram2019-03-121-177/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 4995Kartik Agaram2019-03-061-1/+2
| | | | | Thanks Peter van Hardenberg for causing me to run into this crash (the first time I tried to demo sandboxes in a long time).
* 4994Kartik Agaram2019-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bring back support for incrementally printing the trace to the screen (stderr). I previously thought I didn't need this as long as I'm always incrementally saving to the 'last_run' trace file. But I quickly ran into a use for it: when I want to see a complete trace including switching into the sandbox's trace and back out again. So there are now two separate commandline flags: --trace to save the trace to file --dump to print the trace to screen The former won't handle sandbox traces. But the latter will. I'm deemphasizing --dump in the help message since it should be rarely used. One other situation where I've used stderr in the past is for just raw convenience. But trying to always use the trace was a foolish consistency. Conclusion: a) For simple debugging, feel free to just use cout/cerr. Delete them before committing. b) If the prints get too complex, switch to the trace and browse_trace tool. c) If using nested sandboxes, emit to stderr, redirect to file, and browse_trace. I've gone back and forth on these questions in the past; now I'm trying to be a little more rigorous about capturing reasoning.
* 4993Kartik Agaram2019-03-031-3/+2
| | | | | Fix CI after commit 4987. And track stack depths more correctly inside sandboxes.
* 4987 - support `browse_trace` tool in SubXKartik Agaram2019-02-251-3/+9
| | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 4266 - space for alloc-id in heap allocationsKartik Agaram2018-06-241-51/+86
| | | | This has taken me almost 6 weeks :(
* 4258 - undo 4257Kartik Agaram2018-06-151-67/+44
|
* 4257 - abortive attempt at safe fat pointersKartik Agaram2018-06-151-44/+67
| | | | | | | | | | | | | | | | 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.
* 4088Kartik K. Agaram2017-10-211-1/+1
| | | | | I no longer remember why we were disabling memory reclamation inside sandboxes. Everything seems to be working. Just take it out.
* 3966Kartik K. Agaram2017-07-091-1/+1
|
* 3907 - standardize test failure messagesKartik K. Agaram2017-06-151-2/+2
|
* 3888 - beginnings of a profilerKartik K. Agaram2017-05-281-0/+5
| | | | Time to make my ad hoc commented out code fragments a first-class feature.
* 3805Kartik K. Agaram2017-03-201-3/+45
|
* 3803Kartik K. Agaram2017-03-201-1/+0
|
* 3802 - more accurate sandbox resultsKartik K. Agaram2017-03-201-1/+21
| | | | Thanks Lakshman Swaminathan for reporting this issue.
* 3801Kartik K. Agaram2017-03-201-5/+5
|
* 3730Kartik K. Agaram2017-01-061-0/+8
| | | | | | | Properly support reloading lessons containing scenarios in edit/ and sandbox/ apps. I was so sure I tested this for commit 3724, but apparently not.
* 3705 - switch to tested file-system primitivesKartik K. Agaram2016-12-111-1/+1
|
* 3561Kartik K. Agaram2016-10-221-2/+2
|
* 3409Kartik K. Agaram2016-09-221-0/+4
| | | | | | | Support reloading the recipe side of the edit/ app when it includes type abbreviations. Thanks Ella Couch for reporting this problem.
* 3408Kartik K. Agaram2016-09-221-11/+1
|
* 3390Kartik K. Agaram2016-09-171-5/+5
|
* 3389Kartik K. Agaram2016-09-171-3/+3
|
* 3388Kartik K. Agaram2016-09-171-1/+1
|
* 3385Kartik K. Agaram2016-09-171-16/+16
|
* 3379Kartik K. Agaram2016-09-171-4/+4
| | | | Can't use type abbreviations inside 'memory-should-contain'.
* 3377Kartik K. Agaram2016-09-171-25/+25
|
* 3374Kartik K. Agaram2016-09-161-10/+10
|
* 3367Kartik K. Agaram2016-09-151-8/+24
| | | | | | | | | | | | | | | | | | | | | | Solution to a minor puzzle that came up during today's lesson with Ella: some sandboxes were showing the address of text results, while others were showing their contents. It took a while to realize that the distinction lay in whether the sandbox was saving the results in a text variable: new [abc] => <some address> x:text <- new [abc] => abc It took *much* longer to realize why I couldn't make the first case work like the second. Eventually I realized why: recipes were reclaiming their results if they weren't 'escaping' -- that is, being saved in a variable in the caller so they could be used later. Any solution to this would be a hack, so I'm going to just leave it alone. Type abbreviations should help minimize the extra typing needed to get sandboxes to show text contents.
* 3269Kartik K. Agaram2016-08-281-1/+0
| | | | | | | | | Deconstruct the tracing layer which had been an exception to our includes-types-prototypes-globals-functions organization thus far. To do this we predefine a few primitive globals before the types that use them, and we pull some method definitions out of struct definitions at the cost of having to manually write a couple of prototypes.
* 3230Kartik K. Agaram2016-08-201-0/+518