about summary refs log tree commit diff stats
path: root/040brace.cc
Commit message (Collapse)AuthorAgeFilesLines
* 3549Kartik K. Agaram2016-10-221-2/+2
| | | | | | | | | | | | | | | | | | 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.
* 3522Kartik K. Agaram2016-10-191-3/+3
|
* 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.
* 3381Kartik K. Agaram2016-09-171-3/+3
|
* 3380Kartik K. Agaram2016-09-171-46/+46
| | | | | One more place we were missing expanding type abbreviations: inside container definitions.
* 3083Kartik K. Agaram2016-07-011-1/+1
|
* 2990Kartik K. Agaram2016-05-201-5/+5
| | | | | | | | | | 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..
* 2931 - be explicit about making copiesKartik K. Agaram2016-05-061-1/+1
|
* 2874Kartik K. Agaram2016-04-271-20/+20
| | | | | | Be more consistent that 'return' is the name of the instruction, and 'reply' just a synonym. Maybe I should take it out. It wouldn't affect the recipe/ingredient terminology while I teach..
* 2873 - fix a bug in converting conditional returnsKartik K. Agaram2016-04-271-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* 2773 - switch to 'int'Kartik K. Agaram2016-03-131-8/+8
| | | | This should eradicate the issue of 2771.
* 2735 - define recipes using 'def'Kartik K. Agaram2016-03-081-17/+17
| | | | | | | | | | | | 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.
* 2712Kartik K. Agaram2016-02-261-4/+4
|
* 2701 - turn some warnings into errorsKartik K. Agaram2016-02-251-1/+1
| | | | | | | I really have only one warning left: when somebody redefines a function. I think I'm going to just turn that into an error as well and drop the notion of warnings altogether. Anytime we find something wrong we stop running the program. This is a place where hygiene is justified.
* 2685Kartik K. Agaram2016-02-221-1/+1
|
* 2681 - drop reagent types from reagent propertiesKartik K. Agaram2016-02-211-1/+0
| | | | | | | | | | | | | | | | | All my attempts at staging this change failed with this humongous commit that took all day and involved debugging three monstrous bugs. Two of the bugs had to do with forgetting to check the type name in the implementation of shape-shifting recipes. Bug #2 in particular would cause core tests in layer 59 to fail -- only when I loaded up edit/! It got me to just hack directly on mu.cc until I figured out the cause (snapshot saved in mu.cc.modified). The problem turned out to be that I accidentally saved a type ingredient in the Type table during specialization. Now I know that that can be very bad. I've checked the traces for any stray type numbers (rather than names). I also found what might be a bug from last November (labeled TODO), but we'll verify after this commit.
* 2677Kartik K. Agaram2016-02-201-1/+1
| | | | Include type names in the type tree. Though we aren't using them yet.
* 2494Kartik K. Agaram2015-11-281-1/+1
| | | | | Some more structure to transforms, and flattening of dependencies between them.
* 2397Kartik K. Agaram2015-11-081-0/+1
| | | | | Fix that stray issue with a better phase ordering. Another thing I'm not testing.
* 2383 - new concern: idempotence of transformsKartik K. Agaram2015-11-061-1/+1
| | | | | I'd not paid any attention to it so far, but I need to do so from now on.
* 2382Kartik K. Agaram2015-11-061-0/+1
| | | | Starting to leave commented out prints again out of desperation.
* 2377 - stop using operator[] in mapKartik K. Agaram2015-11-061-16/+16
| | | | | | | | | | | | | | | | 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.
* 2372Kartik K. Agaram2015-11-051-0/+4
|
* 2360Kartik K. Agaram2015-11-041-3/+35
| | | | | | | | | 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.
* 2358 - starting to tackle the phase ordering problemKartik K. Agaram2015-11-041-3/+2
| | | | | | | 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.
* 2349Kartik K. Agaram2015-11-021-19/+0
|
* 2348Kartik K. Agaram2015-11-021-5/+5
|
* 2321 - more preparations for static dispatchKartik K. Agaram2015-10-291-29/+22
| | | | | Deduce operation id from name during transform rather than load, so that earlier transforms have a chance to modify the name.
* 2311Kartik K. Agaram2015-10-291-55/+55
|
* 2277 - reagents now have a tree of typesKartik K. Agaram2015-10-251-1/+1
|
* 2258 - separate warnings from errorsKartik K. Agaram2015-10-061-10/+10
| | | | | | | 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.
* 2226 - standardize warning formatKartik K. Agaram2015-10-011-2/+2
| | | | | | | | 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?
* 2199 - stop printing numbers in scientific notationKartik K. Agaram2015-09-141-3/+3
| | | | | | | | | | | Turns out the default format for printing floating point numbers is neither 'scientific' nor 'fixed' even though those are the only two options offered. Reading the C++ standard I found out that the default (modulo locale changes) is basically the same as the printf "%g" format. And "%g" is basically the shorter of: a) %f with trailing zeros trimmed b) %e So we'll just do %f and trim trailing zeros.
* 2137Kartik K. Agaram2015-09-031-1/+0
|
* 2095Kartik K. Agaram2015-08-281-2/+0
| | | | | | | | | | | | 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.
* 2075Kartik K. Agaram2015-08-241-0/+16
| | | | Thanks Caleb Couch for bugfixes 2072-2075.
* 2043Kartik K. Agaram2015-08-201-1/+1
| | | | | Traces were changing based on whether I was loading a .mu file with 'main' or not.
* 1962Kartik K. Agaram2015-08-091-2/+2
| | | | Standardize test names.
* 1868 - start using naked literals everywhereKartik K. Agaram2015-07-281-38/+38
| | | | First step to reducing typing burden. Next step: inferring types.
* 1847Kartik K. Agaram2015-07-251-2/+2
|
* 1844 - explicitly end each trace lineKartik K. Agaram2015-07-251-11/+11
| | | | | | | | | More verbose, but it saves trouble when debugging; there's never something you thought should be traced but just never came out the other end. Also got rid of fatal errors entirely. Everything's a warning now, and code after a warning isn't guaranteed to run.
* 1837Kartik K. Agaram2015-07-241-4/+4
| | | | | | Don't die on unbalanced '{'. I won't bother adding more tests for warnings. Suffice it to say that we need to gradually eliminate all asserts that check for illegal mu code.
* 1763 - warn on break/loop outside {}Kartik K. Agaram2015-07-111-85/+54
|
* 1702 - experiment: start using 'ordinal' in namesKartik K. Agaram2015-07-041-25/+25
| | | | | | | It comes up pretty early in the codebase, but hopefully won't come up in the mu level until we get to higher-order recipes. Potentially intimidating name, but such prime real estate with no confusing overloadings in other projects!
* 1585Kartik K. Agaram2015-06-171-6/+6
|
* 1394Kartik K. Agaram2015-05-171-2/+2
|
* 1391 - avoid unsigned integersKartik K. Agaram2015-05-171-8/+8
|
* 1390 - support non-integer literalsKartik K. Agaram2015-05-171-8/+12
| | | | | | | | | | | | | | | | | | | | Since '3.14159:literal' looks ugly, we'll just say '3.14159'. It's not like non-integers can be confused for anything but literals. Once I tried to turn reagent values into doubles, I uncovered a bug: arithmetic using signed integers is busted; if either operand of subtraction is unsigned the result is unsigned as well. If it needs to be negative: ka-boom. It was only masked because I was eventually storing the result in a long long int, where it was out of range, and so overflowing into the correct signed value. Once I switched to doubles the unsigned value would indeed fit without overflowing. Ka-boom. Yet another reminder that unsigned integers suck. I started using them mostly to avoid warnings in loops when comparing with .size(), which is usually a size_t. Who knows what other crap lurks here. Just use signed integers everywhere. (And avoid bitwise operators.)
* 1363 - rename 'integer' to 'number'Kartik K. Agaram2015-05-131-44/+44
| | | | ..now that we support non-integers.
* 1362Kartik K. Agaram2015-05-131-1/+1
| | | | | | | | Mu allows us to use multiple ingredients/products without commas, but make sure we don't. $ grep "<- [^ ]\+ [^#\[,]* [^#\[,]*$" * $ grep "^[ ]*[^ #,][^#,]* [^#,]* <- " *