From 81770cf8f2b3a9d9c992520feb1c93c47d154237 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 9 Feb 2004 10:31:48 +0000 Subject: [PATCH] We compile maxfunc and hello now. --- mad | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mad b/mad index 0cc3815..6d5ea55 100755 --- a/mad +++ b/mad @@ -107,11 +107,19 @@ scopes = [] targets = {} headers = [] funcnames = [] +typedict = {} arraydepths = {} returntypes = {} -currentfunc = 'main.' -typedict = {'main.':{}} +def initfunc(f): + global currentfunc + currentfunc = f + typedict[currentfunc] = {} + arraydepths[currentfunc] = {} + funcnames.append(currentfunc) + +initfunc("main.") +returntypes['main.'] = 'int' # Program level @@ -173,11 +181,8 @@ def p_end_of_functions(t): def p_entry(t): "statement : ENTRY TO FUNCALL" global currentfunc - currentfunc = t[3] + initfunc(t[3]) t[0] = ('entry', currentfunc) - typedict[currentfunc] = {} - arraydepths[currentfunc] = {} - funcnames.append(currentfunc) ## EXECUTE def p_execute(t): @@ -430,6 +435,7 @@ def analyze(): break if deck[i][3][0] != 'external_function': deck.insert(i, (deck[i][0], i, None, ('entry', 'main.',()))) + else: for i in range(len(deck)): (file, line, label, statement) = deck[i] -- 2.43.0