diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-11 17:14:48 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-11 17:50:36 -0700 |
commit | cdf0f349d1ad432d785cf69c7a136fff07258adf (patch) | |
tree | fe88b7b2039e9d50ce5b37cc115315a12f22d797 /017parse_tree.cc | |
parent | 68578a7828ce8300fa10b28b5f57e56723303e93 (diff) | |
download | mu-cdf0f349d1ad432d785cf69c7a136fff07258adf.tar.gz |
3324 - completely redo type abbreviations
The old approach with '&' and '@' modifiers turned out to be a bad idea because it introduces notions of precedence. Worse, it turns out you want different precedence rules at different times as the old test alluded: x:@number:3 # we want this to mean (address number 3) x:address:@number # we want this to mean (address array number) Instead we'll give up and focus on a single extensible mechanism that allows us to say this instead: x:@:number:3 x:address:@:number In addition it allows us to shorten other types as well: x:&:@:num type board = &:@:&:@:char # for tic-tac-toe Hmm, that last example reminds me that we don't handle abbreviations inside type abbreviation definitions so far..
Diffstat (limited to '017parse_tree.cc')
-rw-r--r-- | 017parse_tree.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/017parse_tree.cc b/017parse_tree.cc index 8efcb83e..83a96d6b 100644 --- a/017parse_tree.cc +++ b/017parse_tree.cc @@ -7,6 +7,9 @@ // the first element of a type tree is always an atom, and left and right // pointers of non-atoms are never NULL. All type trees are 'dotted' in lisp // parlance. +// +// For now you can't use the simpler 'colon-based' representation inside type +// trees. Once you start typing parens, keep on typing parens. :(scenarios load) :(scenario dilated_reagent_with_nested_brackets) @@ -23,6 +26,7 @@ type_names = parse_string_tree(type_names); :(code) string_tree* parse_string_tree(string_tree* s) { assert(s->atom); + assert(!s->value.empty()); if (s->value.at(0) != '(') return s; string_tree* result = parse_string_tree(s->value); delete s; |