Commit Graph

25 Commits

Author SHA1 Message Date
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 2b25071710 3877 2017-05-26 17:36:16 -07:00
Kartik K. Agaram e62aa7e305 3810
Stop naming 'jump' instructions in their errors since they're so often
rewritten from 'break' or 'loop' instructions.

Thanks Lakshman Swaminathan for running into this issue.
2017-04-04 00:18:44 -07:00
Kartik K. Agaram d3c120c1e2 3549
More consistent definitions for jump targets and waypoints.

1. A label is a word starting with something other than a letter or
digit or '$'.

2. A waypoint is a label that starts with '<' and ends with '>'. It has
no restrictions. A recipe can define any number of waypoints, and
recipes can have duplicate waypoints.

3. The special labels '{' and '}' can also be duplicated any number of
times in a recipe. The only constraint on them is that they have to
balance in any recipe. Every '{' must be followed by a matching '}'.

4. All other labels are 'jump targets'. You can't have duplicate jump
targets in a recipe; that would make jumps ambiguous.
2016-10-22 11:28:46 -07:00
Kartik K. Agaram 6c96a437ce 3522 2016-10-19 22:10:35 -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 555d95c168 3327 2016-09-11 18:17:46 -07:00
Kartik K. Agaram 9dcbec398c 2990
Standardize quotes around reagents in error messages.

I'm still sure there's issues. For example, the messages when
type-checking 'copy'. I'm not putting quotes around them because in
layer 60 I end up creating dilated reagents, and then it's a bit much to
have quotes and (two kinds of) brackets. But I'm sure I'm doing that
somewhere..
2016-05-20 22:11:34 -07:00
Kartik K. Agaram b24eb4766a 2773 - switch to 'int'
This should eradicate the issue of 2771.
2016-03-13 20:26:47 -07: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 fa6d93b2ee 2722 - fix a crash; thanks Ella Couch! 2016-02-28 10:37:37 -08:00
Kartik K. Agaram 1b76245c63 2712 2016-02-26 13:04:55 -08:00
Kartik K. Agaram f22250a174 2680
Delete all the [] that has crept in since 2377 in November.
2016-02-20 21:58:48 -08:00
Kartik K. Agaram 215365d427 2494
Some more structure to transforms, and flattening of dependencies
between them.
2015-11-28 22:17:47 -08:00
Kartik K. Agaram a1b0688786 2493 - eliminate a couple of dependencies
In general you only want to specify one transform in terms of
(before/after) another if the other direction wouldn't work. Otherwise
try to make it work by just pushing transforms at the start/end of the
list.
2015-11-28 21:53:51 -08:00
Kartik K. Agaram ef96f57ce2 2441 - never miss any specializations
I was failing to specialize calls containing literals. And then I had to
deal with whether literals should map to numbers or characters. (Answer:
both.)

One of the issues that still remains: shape-shifting recipes can't be
called with literals for addresses, even if it's 0.
2015-11-15 00:37:29 -08:00
Kartik K. Agaram b2e4056d66 2383 - new concern: idempotence of transforms
I'd not paid any attention to it so far, but I need to do so from now
on.
2015-11-06 17:29:52 -08:00
Kartik K. Agaram f3760b0f28 2379 - further improvements to map operations
Commands run:

  $ sed -i 's/\([^. (]*\)\.find(\([^)]*\)) != [^.]*\.end()/contains_key(\1, \2)/g' 0[^0]*cc
  $ sed -i 's/\([^. (]*\)\.find(\([^)]*\)) == [^.]*\.end()/!contains_key(\1, \2)/g' 0[^0]*cc
2015-11-06 13:22:30 -08:00
Kartik K. Agaram 795f5244ab 2377 - stop using operator[] in map
I'm still seeing all sorts of failures in turning on layer 11 of edit/,
so I'm backing away and nailing down every culprit I run into. First up:
stop accidentally inserting empty objects into maps during lookups.

Commands run:
  $ sed -i 's/\(Recipe_ordinal\|Recipe\|Type_ordinal\|Type\|Memory\)\[\([^]]*\)\] = \(.*\);/put(\1, \2, \3);/' 0[1-9]*
  $ vi 075scenario_console.cc  # manually fix up Memory[Memory[CONSOLE]]
  $ sed -i 's/\(Memory\)\[\([^]]*\)\]/get_or_insert(\1, \2)/' 0[1-9]*
  $ sed -i 's/\(Recipe_ordinal\|Type_ordinal\)\[\([^]]*\)\]/get(\1, \2)/' 0[1-9]*
  $ sed -i 's/\(Recipe\|Type\)\[\([^]]*\)\]/get(\1, \2)/' 0[1-9]*

Now mu dies pretty quickly because of all the places I try to lookup a
missing value.
2015-11-06 11:17:25 -08:00
Kartik K. Agaram 436b2b2eac 2360
More flailing around trying to come up with the right phase ordering.
I've tried to narrow down each transform's constraints wrt transforms in
previous layers.

One issue that keeps biting me is the Type map containing empty records
because of stray [] operations. That's gotta be important.
2015-11-04 23:44:46 -08:00
Kartik K. Agaram 5a4810855d 2358 - starting to tackle the phase ordering problem
A new externality is starting to make its presence felt.

Until I sort this out it's going to be hard to finish making duplex-list
generic.
2015-11-04 23:35:21 -08:00
Kartik K. Agaram e669248264 2321 - more preparations for static dispatch
Deduce operation id from name during transform rather than load, so that
earlier transforms have a chance to modify the name.
2015-10-29 17:15:09 -07:00
Kartik K. Agaram 5f98a10cc7 2258 - separate warnings from errors
At the lowest level I'm reluctantly starting to see the need for errors
that stop the program in its tracks. Only way to avoid memory corruption
and security issues. But beyond that core I still want to be as lenient
as possible at higher levels of abstraction.
2015-10-06 22:15:45 -07:00
Kartik K. Agaram 4814bf94e7 2226 - standardize warning format
Always show recipe name where error occurred. But don't show internal
'interactive' name for sandboxes, that's just confusing.

What started out as warnings are now ossifying into errors that halt all
execution. Is this how things went with C and Unix as well?
2015-10-01 13:13:10 -07:00
Kartik K. Agaram 4adb09bc12 2138 - warn on jump to an ambiguous label
This seemingly simple goal uncovered a little nest of bugs: it turns out
I've been awash in ambiguous labels until now. My baseline recipes in
edit.mu were clean, but they introduced duplicate <waypoints> -- and
*those* waypoints contained +jump-targets. Result: duplicate jump
targets, so that I wasn't jumping where I thought I was jumping. Somehow
I happened to be picking one of the alternatives that magically kept
these issues quiescent.

My first plan to fix this was to mangle names of all labels inside
before/after fragments, keep the jump targets private to their fragment.
But the labels also include more waypoints! Mangle those, and I can't
tangle to them anymore.

Solution: harden the convention that jump targets begin with '+' and
waypoints are surrounded by '<>'. Mangle jump targets occurring inside
before/after fragments to keep them private to their lexical fragment,
but *don't* mangle waypoints, which must remain globally accessible.
2015-09-04 00:22:36 -07:00