diff 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
line wrap: on
line diff
--- a/modules/ast.tp	Thu Apr 16 08:46:35 2015 -0700
+++ b/modules/ast.tp	Fri Apr 17 17:50:47 2015 -0700
@@ -103,13 +103,18 @@
 				}
 			}
 		}
-
-		symbol <- :_name {
+		
+		symbol:withType <- :_name :_type {
 			#{
 				nodeType <- { _symbol }
+				type <- _type
 				name <- _name
 				stringIndent <- :indent {
-					name
+					_type value: :type {
+						name . " (" . type . ")"
+					} none: {
+						name
+					}
 				}
 				string <- {
 					stringIndent: ""
@@ -120,6 +125,10 @@
 			}
 		}
 
+		symbol <- :_name {
+			symbol: _name withType: (option none)
+		}
+
 		funcall:withArgs:hasReceiver? <- :_tocall :_args :_receiver? {
 			#{
 				nodeType <- { _call }