Beispiel #1
0
def p_WhMark3(p):
    '''WhMark3 : '''
    emit(op='goto', out=p[-6][0])  #goto l1
    emit(op='label', out=p[-6][2])  #exit label
    ST.endScope()
    ST.stackbegin.pop()
    ST.stackend.pop()
    printp(p)
Beispiel #2
0
def p_f_mark3(p):
    ''' f_mark3 : epsilon
    '''
    emit(op='goto', out=p[-3][1])  #goto l2
    emit(op='label', out=p[-3][3])  #exit label
    ST.endScope()
    ST.stackbegin.pop()
    ST.stackend.pop()
    printp(p)
Beispiel #3
0
def p_switch_block(p):
    ''' switch_block : BLOCKBEGIN s_mark1 switch_block_statements_0 BLOCKEND
    '''
    emit('goto', p[2]['label'][1])
    emit('label', p[2]['label'][0])
    for d in p[3]:
        temp = ST.getTemp()
        emit(op='==', out=temp, in1=d['place'], in2=p[2]['idVal']['place'])
        emit('if', d['label'], temp)
    emit('label', p[2]['label'][1])
    ST.endScope()
    printp(p)
Beispiel #4
0
def p_if_mark4(p):
    '''if_mark4 : epsilon
    '''
    ST.endScope()
    emit('label', p[-4]['label'][0])
    printp(p)
Beispiel #5
0
def p_if_mark2(p):
    '''if_mark2 : epsilon
    '''
    ST.endScope()
    emit('label', p[-3]['label'][1])
    printp(p)