from keywords import *
from reg import *
from parse import parse

def evalExp():
	expr = parse(fetch(EXPR)) # make dedicated fetch_expr()?
	# expr = transformMacros(expr)
	evalFunc = getEvalFunc(expr)
	# evalFunc()
	# reassign next step

def getEvalFunc(expr):
	if isVar(expr):
		return compVar

	if isNum(expr):
		return compNum

	# else
	tag, *_ = expr

	keyword_groups = {
		define_keys : evalDef, 
		ass_keys : evalAss, 
		lambda_keys : evalLambda, 
		if_keys : evalIf, 
		begin_keys : evalBegin, 
		quote_keys : evalQuote
	}

	for group in keyword_groups:
		if tag in group:
			return keyword_groups[group]

	# default
	return evalApp

def isNum(exp):
	try:
		return type(int(exp)) == int
	except:
		return False

def isVar(exp):
	return type(exp) == str

@@ -43,21 +43,25 @@
 rom 
-parse
+evalFuncs
  import 
 pars
@@ -56,21 +56,17 @@
  import 
-parse
+*
 %0A%0Adef ev
@@ -86,14 +86,8 @@
 r = 
-parse(
 fetc
@@ -97,40 +97,8 @@
 XPR)
-) # make dedicated fetch_expr()?
 %0A%09# 
@@ -157,18 +157,16 @@
 (expr)%0A%09
-# 
 evalFunc
@@ -172,29 +172,8 @@
 c()%0A
-%09# reassign next step
 %0A%0Ade
@@ -219,20 +219,20 @@
 %09return 
-comp
+eval
 Var%0A%0A%09if
@@ -258,12 +258,12 @@
 urn 
-comp
+eval
 Num%0A
@@ -310,16 +310,18 @@
 s = %7B%0A%09%09
+# 
 define_k
@@ -338,16 +338,18 @@
 Def, %0A%09%09
+# 
 ass_keys
@@ -413,16 +413,18 @@
 lIf, %0A%09%09
+# 
 begin_ke
@@ -579,16 +579,17 @@
 valApp%0A%0A
+%0A
 def isNu

Update evalExp