Mercurial > repos > tabletprog
comparison modules/ast.tp @ 358:27477c8c2823
Add support for simple type annotations in parser and update llhello sample with a possible new low-level dialect syntax leveraging those annotations
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 17 Apr 2015 17:50:47 -0700 |
parents | 2308336790d4 |
children |
comparison
equal
deleted
inserted
replaced
357:f237d0cae58b | 358:27477c8c2823 |
---|---|
101 fold:with <- :acc :fun { | 101 fold:with <- :acc :fun { |
102 fun: acc self | 102 fun: acc self |
103 } | 103 } |
104 } | 104 } |
105 } | 105 } |
106 | |
107 symbol:withType <- :_name :_type { | |
108 #{ | |
109 nodeType <- { _symbol } | |
110 type <- _type | |
111 name <- _name | |
112 stringIndent <- :indent { | |
113 _type value: :type { | |
114 name . " (" . type . ")" | |
115 } none: { | |
116 name | |
117 } | |
118 } | |
119 string <- { | |
120 stringIndent: "" | |
121 } | |
122 fold:with <- :acc :fun { | |
123 fun: acc self | |
124 } | |
125 } | |
126 } | |
106 | 127 |
107 symbol <- :_name { | 128 symbol <- :_name { |
108 #{ | 129 symbol: _name withType: (option none) |
109 nodeType <- { _symbol } | |
110 name <- _name | |
111 stringIndent <- :indent { | |
112 name | |
113 } | |
114 string <- { | |
115 stringIndent: "" | |
116 } | |
117 fold:with <- :acc :fun { | |
118 fun: acc self | |
119 } | |
120 } | |
121 } | 130 } |
122 | 131 |
123 funcall:withArgs:hasReceiver? <- :_tocall :_args :_receiver? { | 132 funcall:withArgs:hasReceiver? <- :_tocall :_args :_receiver? { |
124 #{ | 133 #{ |
125 nodeType <- { _call } | 134 nodeType <- { _call } |