Bora vê
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

selection.py 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. def opction(args):
  2. token = []
  3. if args.tudo:
  4. args.lt=True
  5. args.ls=True
  6. args.lse=True
  7. args.lgc=True
  8. if args.lt:
  9. vlt(args.filename,token,args)
  10. else:
  11. lt(args.filename,token,args)
  12. ls(token,args)
  13. lse(token,args)
  14. lgc(token,args)
  15. def vlt(filename,token,args):
  16. from lexical import tokenize
  17. print ('#' * 80)
  18. file = open(filename, "r")
  19. arquivo = file.read()
  20. file.close()
  21. print('{:15}'.format('Token'), '{:29}'.format('Lexema'), '{:10}'.format('Linha'), '{:10}'.format('Coluna'))
  22. i = 0
  23. for tok in tokenize(arquivo,args):
  24. token.append(tok)
  25. print('{:15}'.format(token[i][0]), '{:20.11}'.format(token[i][1]), '{:10}'.format(token[i][2]),
  26. '{:10}'.format(token[i][3]))
  27. i += 1
  28. def lt(filename, token, args):
  29. from lexical import tokenize
  30. file = open(filename, "r")
  31. arquivo = file.read()
  32. file.close()
  33. for tok in tokenize(arquivo,args):
  34. token.append(tok)
  35. def ls(token,args):
  36. from beuty import initsintatico
  37. initsintatico(token,args)
  38. def lse(token,args):
  39. from semantico import semantico
  40. semantico(token,args)
  41. def lgc(token,args):
  42. from Geracaodecodigo import intemerdiario
  43. texto = []
  44. intemerdiario(token,args,0,len(token),0,0, texto)
  45. '''
  46. intermediario(token, args, posicao inicial que deseja converter para assembler, posição final, valor inicial das Labels dos loops, valor inicial das Labels dos condicionais)
  47. '''