about summary refs log tree commit diff stats
path: root/022arithmetic.cc
Commit message (Collapse)AuthorAgeFilesLines
* 5001 - drop the :(scenario) DSLKartik Agaram2019-03-121-276/+529
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 4266 - space for alloc-id in heap allocationsKartik Agaram2018-06-241-5/+0
| | | | This has taken me almost 6 weeks :(
* 4265Kartik Agaram2018-06-171-2/+2
| | | | Standardize use of type ingredients some more.
* 4264Kartik Agaram2018-06-171-0/+823
| | | | Undo the relayout of 4259.
* 4259Kartik Agaram2018-06-161-823/+0
|
* 4258 - undo 4257Kartik Agaram2018-06-151-11/+4
|
* 4257 - abortive attempt at safe fat pointersKartik Agaram2018-06-151-4/+11
| | | | | | | | | | | | | | | | 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.
* 3877Kartik K. Agaram2017-05-261-33/+33
|
* 3841Kartik K. Agaram2017-04-271-3/+3
| | | | | Use the real original instruction in error messages. Thanks Ella Couch.
* 3753 - new instruction: 'square-root'Kartik K. Agaram2017-03-041-0/+23
| | | | Thanks Lakshman Swaminathan for the request.
* 3624 - new rounding instruction: 'truncate'Kartik K. Agaram2016-11-051-0/+35
|
* 3622 - handle fractional coordinates in printKartik K. Agaram2016-11-051-0/+12
|
* 3618Kartik K. Agaram2016-10-311-7/+7
|
* 3522Kartik K. Agaram2016-10-191-10/+10
|
* 3381Kartik K. Agaram2016-09-171-2/+2
|
* 3380Kartik K. Agaram2016-09-171-60/+60
| | | | | One more place we were missing expanding type abbreviations: inside container definitions.
* 3210 - new primitive: character-to-codeKartik K. Agaram2016-08-171-0/+35
| | | | Thanks Ella Couch; this was long overdue.
* 3181Kartik K. Agaram2016-08-131-0/+32
|
* 3120Kartik K. Agaram2016-07-211-25/+25
| | | | | | | | Always show instruction before any transforms in error messages. This is likely going to make some errors unclear because they *need* to show the original instruction. But if we don't have tests for those situations did they ever really work?
* 2990Kartik K. Agaram2016-05-201-17/+17
| | | | | | | | | | 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..
* 2803Kartik K. Agaram2016-03-211-28/+28
| | | | | Show more thorough information about instructions in the trace, but keep the original form in error messages.
* 2773 - switch to 'int'Kartik K. Agaram2016-03-131-24/+24
| | | | This should eradicate the issue of 2771.
* 2735 - define recipes using 'def'Kartik K. Agaram2016-03-081-43/+43
| | | | | | | | | | | | 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-45/+45
|
* 2685Kartik K. Agaram2016-02-191-28/+28
| | | | | | | | | | | | | | | | Stack of plans for cleaning up replace_type_ingredients() and a couple of other things, from main problem to subproblems: include type names in the type_tree rather than in the separate properties vector make type_tree and string_tree real cons cells, with separate leaf nodes redo the vocabulary for dumping various objects: do we really need to_string and debug_string? can we have a version with *all* information? can we have to_string not call debug_string? This commit nibbles at the edges of the final task, switching from member method syntax to global function like almost everything else. I'm mostly using methods just for STL in this project.
* 2627 - bitwise operatorsKartik K. Agaram2016-02-041-0/+283
|
* 2626Kartik K. Agaram2016-02-031-0/+80
|
* 2578Kartik K. Agaram2016-01-201-0/+4
|
* 2558Kartik K. Agaram2016-01-121-0/+3
|
* 2377 - stop using operator[] in mapKartik K. Agaram2015-11-061-23/+23
| | | | | | | | | | | | | | | | 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\)\[\([^]]*\)us cushion continue; // not done with caller; don't increment current_step_index() } //:: finally, we need to fix the termination conditions for the run loop :(replace{} "inline bool routine::completed() const") inline bool routine::completed() const { return calls.empty(); } inline const vector<instruction>& routine::steps() const { assert(!calls.empty()); return Recipe[calls.front().running_recipe].steps; } :(before "Running One Instruction") // when we reach the end of one call, we may reach the end of the one below // it, and the one below that, and so on while (current_step_index() >= SIZE(Current_routine->steps())) { // Falling Through End Of Recipe --Callstack_depth; //? cerr << "reply " << SIZE(Current_routine->calls) << '\n'; //? 2 Current_routine->calls.pop_front(); if (Current_routine->calls.empty()) return; // Complete Call Fallthrough // todo: no products returned warning ++current_step_index(); } :(before "End Includes") #include <stack> using std::stack; ='2015-09-30 01:57:23 -0700'>2015-09-301-1/+2
|
* 2220Kartik K. Agaram2015-09-301-34/+109
|
* 2214Kartik K. Agaram2015-09-281-0/+248