def p_declaration(p): 'declaration : type variables' global symbols_table global dimensions_queue for symbol in p[2]: if symbol not in symbols_table: symbols_table[symbol] = Symbol(symbol, p[1]) else: print('Variable redeclaration') raise SyntaxError('Variable redeclaration') while (len(dimensions_queue)): print('SIMBOLO: ', symbol) symbol = dimensions_queue.pop(0).replace('#', '') rows = dimensions_queue.pop(0) if len(dimensions_queue) and isinstance(dimensions_queue[0], int): cols = dimensions_queue.pop(0) symbols_table[symbol].value = np.empty((rows, cols), symbols_table[symbol].type) else: symbols_table[symbol].value = np.empty(rows, symbols_table[symbol].type)