Ejemplo n.º 1
0
Archivo: vispi.py Proyecto: kod3r/Vispi
def resolveMemSection(address):
    section = (address - MemBase) / MemLen
    return MemSectionMap[section] 

def getRandomName():
    name = ''.join(random.choice(string.letters) for i in xrange(5))
    while(name in VarNames):
        name = os.urandom(5)
    return name


if len(sys.argv) == 2:
    global mainFileIsOpen
    data = open(sys.argv[1]).read()
    prog = vispi_parse.parse(data)

    OBJ = open('vispi.obj', 'r')
    Name = OBJ.readline().splitlines()[0]
    CPP = open('vispi.cpp', 'w')
    CPP.write('#include "vispi.h"\n\nusing namespace std;\nusing namespace cv;\n\n')
#    CPP.write('using namespace std;\n\n')
    MAIN = open('tempMain.cpp', 'w')
    mainFileIsOpen = True

    OBJ.readline()  #reads the %%
    Functions = eval(OBJ.readline().splitlines()[0])

    MemBase = int(OBJ.readline().splitlines()[0])
    MemLen = int(OBJ.readline().splitlines()[0])
    print MemBase
Ejemplo n.º 2
0
import sys
sys.path.insert(0,"../..")

if sys.version_info[0] >= 3:
    raw_input = input

import vispi_lex
import vispi_parse

# If a filename has been specified, we try to run it.
# If a runtime error occurs, we bail out and enter
# the other mode below
if len(sys.argv) == 2:
    data = open(sys.argv[1]).read()
    prog = vispi_parse.parse(data)
    
else:
    vispi_parse.parse('''
    	PROGRAM primerTest
		CAM webcam : cam1
		INPUT 8 : boton1, 9: boton2
		OUTPUT 5: led1

		int elefante, paloma
		float tigre
		bool si_o_no

		int funcionextra(int parametro1)
			int otroAnimal
			otroAnimal = parametro1 - 1
			if (otroAnimal != 0)