Example #1
0
def p_FunMark2(p):
    ''' FunMark2 : epsilon
    '''
    ST.endFunc()
    #if(p[-5]==False):
    #    ST.function[p[-6][1]]["return"]=False
    #if(p[-6][1]!="main@0"):
    #    emit("freturn")
    printp(p)
Example #2
0
import sys
import ply.yacc as yacc
import lexer
#from globalvar import *
import pickle
from globalOther import ST
#ST=SymbolTable()
#global ST
#ST.newScope()
ST.addFunc('println')
ST.endFunc()
ST.addFunc('readInt')
ST.endFunc()
#ST.endScope()
x = 1


def newLabel():
    global x
    x = x + 1
    return "label" + str(x)


def is_number(var):
    try:
        int(var)
        return True
    except Exception:
        return False