def compile(self, logoCode): printFunctionName() self.byteCode = pyYacc.analisarCodigo(logoCode, ERCP) if self.byteCode is None: print _("ERROR->Look for a text containing one of the words: "), ERCP[0] return False, ERCP else: self.byteCodeCount = len(self.byteCode) print "< code:", self.byteCode return True, ERCP
def compileAndSend(self, code): code = pyYacc.analisarCodigo(code) print 'Numero de Bytes Usados', len(code) if not None in code: newcode = [] code.reverse() temp = code while len(temp) > 0: byte = temp.pop() if byte == 128: jump = temp.pop() Hi = jump / 256 Lo = jump % 256 newcode.append(byte) newcode.append(Hi) newcode.append(Lo) else: newcode.append(byte) self.enviar(newcode) return True else: return False
#!/usr/bin/env python from pyLogoCompiler import pyYacc pyYacc.analisarCodigo('to test\nbeep\nend')
def compile(self, logoCode, ErrMsgFunc=None): printFunctionName() self.byteCode = pyYacc.analisarCodigo(logoCode, ErrMsgFunc) self.byteCodeCount = len(self.byteCode) print("< code:", self.byteCode)