summaryrefslogtreecommitdiff
path: root/colm/colm.lm
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-03-17 17:13:57 -0400
committerAdrian Thurston <thurston@complang.org>2013-03-17 17:13:57 -0400
commiteadcdd440c23b66cb628969dce830b279e988c0b (patch)
tree5191adb683e3f19d26dcaef7bc13134b58d65353 /colm/colm.lm
parent6203bf33ef153b02222ed529305f5d9efea74bec (diff)
downloadcolm-eadcdd440c23b66cb628969dce830b279e988c0b.tar.gz
added variable declaration
Diffstat (limited to 'colm/colm.lm')
-rw-r--r--colm/colm.lm9
1 files changed, 9 insertions, 0 deletions
diff --git a/colm/colm.lm b/colm/colm.lm
index 6eb3b2ef..f2257d98 100644
--- a/colm/colm.lm
+++ b/colm/colm.lm
@@ -38,6 +38,7 @@ lex
token PLUS /'+'/
token QUESTION /'?'/
token CARET /'^'/
+ token EQUALS /'='/
ignore /
( '\n' | '\t' | ' ' ) .
@@ -113,6 +114,14 @@ def prod_list
def statement
[Print: print_stmt]
| [Expr: expr_stmt]
+| [VarDef: var_def OptDefInit: opt_def_init]
+
+def opt_def_init
+ [EQUALS CodeExpr: code_expr]
+| []
+
+def var_def
+ [Id: id COLON TypeRef: type_ref]
def print_stmt
[PRINT POPEN CodeExprList: code_expr* PCLOSE]