Commit Graph

36 Commits

Author SHA1 Message Date
Kartik Agaram 4a943d4ed3 5001 - drop the :(scenario) DSL
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.
2019-03-12 19:14:12 -07:00
Kartik Agaram c442a5ad80 4987 - support `browse_trace` tool in SubX
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.
2019-02-25 01:50:53 -08:00
Kartik Agaram 377b00b045 4265
Standardize use of type ingredients some more.
2018-06-17 19:53:52 -07:00
Kartik Agaram dd66068298 4261 - start using literals for 'true' and 'false'
They uncovered one bug: in edit/003-shortcuts.mu
  <scroll-down> was returning 0 for an address in one place where I
  thought it was returning 0 for a boolean.

Now we've eliminated this bad interaction between tangling and punning
literals.
2018-06-17 00:29:22 -07:00
Kartik K. Agaram d37c983a77 4231 2018-03-21 21:52:53 -07:00
Kartik K. Agaram d82d903507 4229
Another bugfix, another improved error message.
2018-03-16 00:53:33 -07:00
Kartik K. Agaram 53ba69a7c0 4226 - example program: exceptions
Pretty klunky; we're violating the type system by prepending an extra result,
so functions we want to catch exceptions around have to be header-less
and check input types at run-time.
2018-03-15 22:38:15 -07:00
Kartik K. Agaram f8f222454e 4225 2018-03-15 21:54:53 -07:00
Kartik K. Agaram c1bb5eca95 4213 2018-02-20 22:09:12 -08:00
Kartik K. Agaram acce384bcc 4179 - experiment: rip out memory reclamation
I have a plan for a way to avoid use-after-free errors without all the
overheads of maintaining refcounts. Has the nice side-effect of
requiring manual memory management. The Mu way is to leak memory by
default and build tools to help decide when and where to expend effort
plugging memory leaks. Arguably programs should be distributed with
summaries of their resource use characteristics.

Eliminating refcount maintenance reduces time to run tests by 30% for
`mu edit`:

              this commit                 parent
  mu test:         3.9s                        4.5s
  mu test edit:  2:38                        3:48

Open questions:
  - making reclamation easier; some sort of support for destructors
  - reclaiming local scopes (which are allocated on the heap)
    - should we support automatically reclaiming allocations inside them?
2018-01-03 00:44:09 -08:00
Kartik K. Agaram 5059f32d0d 4160 - named marks for delimited continuations
Hypothesis: this is needed to build McCarthy's amb operator.
  https://rosettacode.org/wiki/Amb
2017-12-15 00:15:47 -08:00
Kartik K. Agaram 1cd833619e 4159
Many continuation examples were failing since commit 4151. Include one
of them as a test.
2017-12-10 03:44:49 -08:00
Kartik K. Agaram 7fb1017bb7 4153 2017-12-07 16:04:47 -08:00
Kartik K. Agaram 20252c5eec 4152 2017-12-07 16:01:43 -08:00
Kartik K. Agaram 07de3e9536 4151 - specializing calls returning continuations 2017-12-07 16:00:02 -08:00
Kartik K. Agaram ba2729b201 4150 2017-12-07 14:56:55 -08:00
Kartik K. Agaram 2a81a54726 4148 2017-12-07 13:45:01 -08:00
Kartik K. Agaram fa76b0b589 4132
Simplify the implementation of calling continuations. Since we don't
support next-ingredient on continuations, might as well not bother with
all that call housekeeping for ingredients.
2017-11-19 22:42:06 -08:00
Kartik K. Agaram 8737438455 4131
Bugfix: I hadn't been allowing continuations to be copied.

Deepens our initial sin of managing the Mu call stack implicitly in the
C interpreter. Since the call stack was implicit, continuations had to
be implicit as well. Since continuations aren't in Mu's memory, we have
to replicate refcounting logic for them.
2017-11-19 04:23:31 -08:00
Kartik K. Agaram 0e1ebc3eb3 4130 2017-11-19 04:18:31 -08:00
Kartik K. Agaram fe63e0d62b 4127 2017-11-19 03:18:11 -08:00
Kartik K. Agaram 5a39e8c049 4126 2017-11-19 02:40:36 -08:00
Kartik K. Agaram c6ab07f700 4124 2017-11-19 02:35:43 -08:00
Kartik K. Agaram 51b3503143 4118 2017-11-06 02:35:54 -08:00
Kartik K. Agaram d55e77387f 4117 - done with delimited continuations
At least this particular implementation of them. Let's play with them
now for a while, see if they're fully equivalent to shift/reduce.
2017-11-06 01:28:53 -08:00
Kartik K. Agaram 3b776ac384 4116 - support calling continuations with arguments
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.
2017-11-06 01:12:42 -08:00
Kartik K. Agaram 485775ec61 4113 2017-11-05 11:17:23 -08:00
Kartik K. Agaram 53de40aa88 4108 2017-11-05 01:49:24 -08:00
Kartik K. Agaram 4c5136859d 4107
Return other values along with the current continuation.
2017-11-05 01:47:03 -08:00
Kartik K. Agaram f78e5cb235 4105 2017-11-03 17:56:35 -07:00
Kartik K. Agaram a89c1bed26 4104
Stop hardcoding Max_depth everywhere; we had a default value for a
reason but then we forgot all about it.
2017-11-03 01:50:46 -07:00
Kartik K. Agaram a3195d440d 4103 - continuations no longer cause memory corruption 2017-11-03 01:49:36 -07:00
Kartik K. Agaram bca60fb7e4 3994 2017-09-13 20:32:51 -07:00
Kartik K. Agaram 03d673bb25 3989 2017-09-01 02:23:45 -07:00
Kartik K. Agaram 4856c70107 3988 2017-09-01 01:50:32 -07:00
Kartik K. Agaram 53930831c4 3986 - bring back delimited continuations
They're back after a long hiatus: commit 2295 in Oct 2015.

I'm not convinced anymore that this is actually a correct implementation
of continuations. Issues on at least two fronts:

a) These aren't safe yet. Since continuations can be called multiple
times, we need to disable reclamation of locals inside a continuation.
There may be other type- or memory-safety issues. However, delimited
continuations at least seem possible to make safe. Undelimited
continuations (call/cc) though are permanently out.

b) They may not actually be as powerful as delimited continuations.
Let's see if I can build 'yield' out of these primitives.
2017-08-30 21:32:54 -07:00