diff lwcc/tree.c @ 501:f3e9732973f1

Add basic integer operations to lwcc Add +, -, *, and / to lwcc parser and code generator. Multiplication and division require helper functions in a yet to be created support library. These operations are integer only for the moment.
author William Astle <lost@l-w.ca>
date Tue, 24 Sep 2019 22:07:56 -0600
parents 1bd2d590d734
children 14a40f8bb4eb
line wrap: on
line diff
--- a/lwcc/tree.c	Thu Aug 29 17:00:17 2019 -0600
+++ b/lwcc/tree.c	Tue Sep 24 22:07:56 2019 -0600
@@ -53,6 +53,10 @@
 	"BLOCK",
 	"STMT_RETURN",
 	"CONST_INT",
+	"OPER_PLUS",
+	"OPER_MINUS",
+	"OPER_TIMES",
+	"OPER_DIVIDE",
 };
 
 
@@ -70,6 +74,13 @@
 	
 	switch (type)
 	{
+	case NODE_OPER_PLUS:
+	case NODE_OPER_MINUS:
+	case NODE_OPER_TIMES:
+	case NODE_OPER_DIVIDE:
+		nargs = 2;
+		break;
+
 	case NODE_DECL:
 		nargs = 2;
 		break;