Commit Graph

117 Commits

Author SHA1 Message Date
Kartik Agaram 01ce563dfe 4262 - literal 'null' 2018-06-17 15:57:37 -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 f94f03cfb0 4167 - show square colors in chessboard app 2017-12-27 23:30:43 -08:00
Kartik K. Agaram 3cb4e19e35 4166 2017-12-27 23:22:31 -08:00
Kartik K. Agaram 4a48bedcd1 4134 - 'input' = 'ingredient' 2017-12-03 23:25:40 -08:00
Kartik K. Agaram 72cf994869 4002 2017-09-23 18:41:47 -07:00
Kartik K. Agaram 5aac71e875 3935 2017-06-22 09:33:29 -07:00
Kartik K. Agaram b6fa632e2f 3861 - screen untouched when entering console mode 2017-05-18 10:14:49 -07:00
Kartik K. Agaram ab6e672d4e 3735 - get rid of 'print-integer'
We do support printing non-integer numbers for some time, albeit using
the underlying host platform.
2017-01-22 12:05:24 -08:00
Kartik K. Agaram 9a81d7460f 3561 2016-10-22 16:56:07 -07:00
Kartik K. Agaram ada5eb55cb 3552
Stop requiring jump instructions to explicitly provide a ':label' type
for jump targets.

This has been a source of repeated confusion for my students:
  a) They'd add the ':label' to the label definition rather than the
  jump target (label use)
  b) They'd spend time thinking about whether the initial '+' prefix was
  part of the label name.

In the process I cleaned up a couple of things:

  - the space of names is more cleanly partitioned into labels and
    non-labels (clarifying that '_' and '-' are non-label prefixes)
  - you can't use label names as regular variables anymore
  - you can infer the type of a label just from its name
2016-10-22 12:08:10 -07:00
Kartik K. Agaram 917e18438f 3497 2016-10-13 23:05:22 -07:00
Kartik K. Agaram 9458918f9e 3483 2016-10-08 10:53:06 -07:00
Kartik K. Agaram a0331a9b0e 3390 2016-09-17 13:00:39 -07:00
Kartik K. Agaram 760f683f27 3389 2016-09-17 12:55:10 -07:00
Kartik K. Agaram 192d59d3bb 3380
One more place we were missing expanding type abbreviations: inside
container definitions.
2016-09-17 00:43:20 -07:00
Kartik K. Agaram 08f4628e8b 3379
Can't use type abbreviations inside 'memory-should-contain'.
2016-09-17 00:31:55 -07:00
Kartik K. Agaram 36b927a63c 3354 - support multiple routines at a source/sink
This commit completes the final step: fixing the final failing tests (in
chessboard.mu) by teaching `restart` about the block signal.
2016-09-15 00:53:27 -07:00
Kartik K. Agaram 431bbb1aa7 3346
Process type abbreviations in *shape-shifting* function headers.
2016-09-13 00:07:38 -07:00
Kartik K. Agaram ea19d0dc2c 3337 - first use of type abbreviations: text
In the process I've uncover a couple of situations we don't support type
abbreviations yet. They're next.
2016-09-12 00:38:36 -07:00
Kartik K. Agaram e0ec710608 3261
Fix CI.
2016-08-26 14:27:44 -07:00
Kartik K. Agaram a791c04264 3020 - names in chessboard tests
Extremely ugly change.

Also ended up fixing some places where I was mixing up sources and
sinks. But I'm not going to bother updating edit/ and sandbox/ apps.
Just too many scenarios to clean up.
2016-05-26 21:43:38 -07:00
Kartik K. Agaram 5b22547bb3 2880
Turns out we don't need a primitive to return an empty value of
arbitrary type. Just create it on the heap using 'new'.

But this uncovered *yet* another bug, sigh. When I specialize generic
functions I was running all transforms on the generated functions after
specialization completed. But there's one transform that includes code
from elsewhere. If such code included type-ingredients -- kaboom. Now
fixed and there's a test, so I've got that going for me which is nice.
2016-04-27 22:28:55 -07:00
Kartik K. Agaram e32a6a02ee 2878 2016-04-27 17:59:46 -07:00
Kartik K. Agaram e765f9e74a 2873 - fix a bug in converting conditional returns
This was an interaction between two transforms. The first turned:

  return-if ...

into:

  jump-unless ..., 1:offset  # skip next instruction
  return ...

The second added an unconditional return at the end of the recipe if it
didn't already exist (so that functions always end with a return).
However, it was getting confused by the return instructions generated
above, which look unconditional but sometimes get skipped.

To fix this, conditional returns are now transformed into this:

  {
    break-unless ...
    return ...
  }

Since the final instruction is now no longer a reply (but rather the '}'
label), the second transform triggers and adds the unconditional return
after it.

This commit removes the final place marked 'BUG:' in the codebase
yesterday (see commit 2870).
2016-04-27 15:23:44 -07:00
Kartik K. Agaram 5b1219ca19 2870 - fix the final long-standing failing test
The solution for avoiding deadlock is for routines to close channels
before they exit. So that's good.

Once I implemented 'close', I also found and fixed 2 unrelated bugs in
chessboard.mu:
  a) one long-missed and long-masked case of forgetting to store
  character literals in character variables
  b) one typo in translating get-address to put
So that's good.

What's not so good: in the process of fixing this I've found three
unrelated bugs (marked 'BUG:' in the changes). All three have
workarounds, so existing tests pass for now. But they are my top
priority next.
2016-04-27 00:10:20 -07:00
Kartik K. Agaram b0bf5321de 2864 - replace all address:shared with just address
Now that we no longer have non-shared addresses, we can just always
track refcounts for all addresses.

Phew!
2016-04-24 11:54:30 -07:00
Kartik K. Agaram 991d76f328 2860 - rename 'index-address' to 'put-index' 2016-04-23 14:51:20 -07:00
Kartik K. Agaram 13485a58ea 2845 2016-04-16 22:19:53 -07:00
Kartik K. Agaram 3ac523393d 2798 - experiment: split channels into two ends
This way when you pass one end to a function or routine, you can
implicitly give it the right to either read or write the channel, but
not both.

The cost: code gets more convoluted, names get more convoluted. You can
see this in particular in the test for buffer-lines. Let's see how it
goes..
2016-03-19 15:57:10 -07:00
Kartik K. Agaram 637cc4139b 2784 - make channels generic
I've ignored Mu's concurrency primitives for a while, but they're
starting to return to front-and-center as I work on the file system
interfaces.
2016-03-14 18:24:33 -07:00
Kartik K. Agaram 44bab2e4b4 2782 - directly use string literals everywhere 2016-03-14 13:00:21 -07:00
Kartik K. Agaram 83edf90dc3 2749 2016-03-09 19:23:44 -08:00
Kartik K. Agaram b1a672a202 2748 2016-03-09 16:41:40 -08:00
Kartik K. Agaram e66851d897 2746 2016-03-09 14:54:41 -08:00
Kartik K. Agaram 1ead356219 2735 - define recipes using 'def'
I'm dropping all mention of 'recipe' terminology from the Readme. That
way I hope to avoid further bike-shedding discussions while I very
slowly decide on the right terminology with my students.

I could be smarter in my error messages and use 'recipe' when code uses
it and 'function' otherwise. But what about other words like ingredient?
It would all add complexity that I'm not yet sure is worthwhile. But I
do want separate experiences for veteran programmers reading about Mu on
github and for people learning programming using Mu.
2016-03-08 01:46:47 -08:00
Kartik K. Agaram 455fbac64f 2576 - distinguish allocated addresses from others
This is the one major refinement on the C programming model I'm planning
to introduce in mu. Instead of Rust's menagerie of pointer types and
static checking, I want to introduce just one new type, and use it to
perform ref-counting at runtime.

So far all we're doing is updating new's interface. The actual
ref-counting implementation is next.

One implication: I might sometimes need duplicate implementations for a
recipe with allocated vs vanilla addresses of the same type. So far it
seems I can get away with just always passing in allocated addresses;
the situations when you want to pass an unallocated address to a recipe
should be few and far between.
2016-01-19 23:18:03 -08:00
Kartik K. Agaram bb33c5e899 2573 - check product type of 'new'
I realize that my current doesn't allow nesting a🅱️c linear type syntax
inside a dilated property. So you can't currently say:

  (recipe address:number)

Need to fix that at some point. Non-trivial since linear syntax is
oblivious to dilated syntax. I should probably make the dilated syntax
more fundamental and introduce it at an earlier layer.
2016-01-19 18:46:39 -08:00
Kartik K. Agaram 83d8299d2d 2562
We want to use the type 'recipe' for recipe *variables*, because it
seems nicer to say `recipe number -> number` rather than recipe-ordinal,
etc. To support this we'll allow recipe names to be mentioned without
any type.

This might make a couple of places in this commit more brittle. I'm
dropping error messages, causing them to not happen in some situations.
Maybe I should just bite the bullet and require an explicit
:recipe-literal. We'll see.
2016-01-17 23:15:03 -08:00
Kartik K. Agaram bbe0801ab1 2548 - teach 'print' to print integers
Still can't print non-integer numbers, so this is a bit hacky.

The big consequence is that you can't print literal characters anymore
because of our rules about how we pick which variant to statically
dispatch to. You have to save to a character variable first.

Maybe I can add an annotation to literals..
2015-12-28 08:44:36 -08:00
Kartik K. Agaram a5ab5b24e7 chessboard.mu now working 2015-12-15 10:20:41 -08:00
Kartik K. Agaram 136412d263 2468 - overload print-character as just 'print' 2015-11-21 10:19:34 -08:00
Kartik K. Agaram 3f7eed6c60 2467 - rename 'string' to 'text' everywhere
Not entirely happy with this. Maybe we'll find a better name. But at
least it's an improvement.

One part I *am* happy with is renaming string-replace to replace,
string-append to append, etc. Overdue, now that we have static dispatch.
2015-11-21 10:04:38 -08:00
Kartik K. Agaram 104854ca94 2460 - headers for remaining recipes 2015-11-18 22:03:43 -08:00
Kartik K. Agaram 1fa530589e 2299 - check types of ingredients in calls
Still very incomplete:

a) we perform the check at runtime

b) tests for edit and sandbox apps no longer work; we can't fix them
until we get type parameters in both containers and recipes (because
list and list operations need to become generic).
2015-10-28 13:19:41 -07:00
Kartik K. Agaram e00d485428 2260 - start tracing by depth rather than label
Now we can collect all traces, just modulating the depth.
2015-10-06 23:38:28 -07:00
Kartik K. Agaram d4cb1a51db 2244 2015-10-05 18:16:12 -07:00
Kartik K. Agaram 6c1376f830 2095
Finally terminate the experiment of keeping debug prints around. I'm
also going to give up on maintaining counts.

What we really need is two kinds of tracing:
  a) For tests, just the domain-specific facts, organized by labels.
  b) For debugging, just transient dumps to stdout.
b) only works if stdout is clean by default.

Hmm, I think this means 'stash' should be the transient kind of trace.
2015-08-28 23:25:21 -07:00
Kartik K. Agaram c106cabdb1 2051
Forgot to fix chessboard tests during commit 2022: running sandboxes in
separate routines.
2015-08-21 10:37:29 -07:00
Kartik K. Agaram b318b7fb12 1884 2015-07-29 15:11:33 -07:00