Beispiel #1
0
def p_WhMark1(p):
    '''WhMark1 : '''
    l1 = newLabel()
    l2 = newLabel()
    l3 = newLabel()
    ST.stackbegin.append(l1)
    ST.stackend.append(l3)
    ST.newScope()
    emit(op='label', out=l1)  #emit label 1
    p[0] = [l1, l2, l3]
    printp(p)
Beispiel #2
0
def p_s_mark1(p):
    '''s_mark1 : epsilon
    '''
    ST.newScope()
    test = newLabel()
    exit = newLabel()
    emit('goto', test)
    ST.stackbegin.append(test)
    ST.stackend.append(exit)
    p[0] = {'label': [test, exit], 'idVal': p[-3]}
    printp(p)
Beispiel #3
0
def p_if_mark1(p):
    '''if_mark1 : epsilon
    '''
    p[0] = {}
    l1 = newLabel()
    l2 = newLabel()
    emit('if', l1, p[-3]['place'])
    emit('goto', l2)
    emit('label', l1)
    ST.newScope()
    p[0]['label'] = [l1, l2]
    printp(p)
Beispiel #4
0
def p_f_scope_mark(p):
    '''f_scope_mark : epsilon
    '''
    ST.newScope()
    printp(p)