def expression_whiler(p): while (True): if (isinstance(p[1], typed.ListCodeBlock)): for i in p[1].evalv(): parser.parsetxt(i) else: parser.parsetxt(p[1].evalv())
def expression_runf(p): try: if (isinstance(function.getfunction(p[0].getstr()), function.PycFunction)): INPFUNC_SPECIAL_1 = p OUTFUNC_SPECIAL_1 = None ldict = locals() exec(function.getfunction(p[0].getstr()).pyc, None, ldict) OUTFUNC_SPECIAL_1 = ldict['OUTFUNC_SPECIAL_1'] return typed.returntype(OUTFUNC_SPECIAL_1) else: iterv = 1 itervas = 1 for i in function.getfunction(p[0].getstr()).args: variable.addvariable( variable.Variable(i, variable.variabletypelist[0], p[itervas].evalv())) itervas += 1 for i in function.getfunction(p[0].getstr()).code: if (len(function.getfunction(p[0].getstr()).code) != iterv): parser.parsetxt(i) else: return parser.parsetxtreturn(i) iterv += 1 intervas = 1 for i in function.getfunction(p[0].getstr()).args: variable.remvariable(i) itervas += 1 except AttributeError: raise AttributeError('Unknown Function "{0}" at line {1}'.format( p[0].getstr(), parser.linenum))
def expression_timedr(p): i = 0 while (i < p[1].evalv()): if (isinstance(p[2], typed.ListCodeBlock)): for d in p[2].evalv(): parser.parsetxt(d) else: parser.parsetxt(p[2].evalv()) i = i + 1
def runfilesal(text): strfinish = "" with open(text) as f: for line in f: strfinish = strfinish + line strfinish = strfinish.replace('\n', '') strfinish = strfinish.replace(';', '\n') for line in strfinish.splitlines(): parser.parsetxt(line)
def expression_whiler(p): running = True while (running): if (p[1].evalv() == False): running = False if (isinstance(p[2], typed.ListCodeBlock)): for i in p[2].evalv(): parser.parsetxt(i) else: parser.parsetxt(p[2].evalv())
def main(argv): linenumber = 1 import parser import variablepar import functionpar parser.parser = parser.pg.build() strfinish = "" with open("test.salmon") as f: for line in f: strfinish = strfinish + line strfinish = strfinish.replace('\n', '') strfinish = strfinish.replace(';', '\n') for line in strfinish.splitlines(): parser.parsetxt(line, True)
def expression_varname(p): if(function.getfunction(p[0].getstr()) != None): if(isinstance(function.getfunction(p[0].getstr()),function.PycFunction)): INPFUNC_SPECIAL_1 = p OUTFUNC_SPECIAL_1 = None ldict = locals() exec(function.getfunction(p[0].getstr()).pyc,None,ldict) OUTFUNC_SPECIAL_1 = ldict['OUTFUNC_SPECIAL_1'] return typed.returntype(OUTFUNC_SPECIAL_1) else: iterv = 1 for i in function.getfunction(p[0].getstr()).code: if(len(function.getfunction(p[0].getstr()).code) != iterv): parser.parsetxt(i) else: return parser.parsetxtreturn(i) iterv+=1 else: return VariableName(p[0].getstr())
import parser import variablepar parser.parsetxt("hello = 10")
def expression_ifr(p): print(p[1]) if (p[1].evalv() == True): for i in p[2].evalv(): parser.parsetxt(i)
def runfile(filename): with open(filename) as fp: for line in fp: if ord(line[0]) != 10: parser.parsetxt(line)