2 Commits

Author SHA1 Message Date
  Nicolas T e1d7177133 fixando importações 4 years ago
  Nicolas T a2eb0f7b8f fixando importações 4 years ago
4 changed files with 14 additions and 14 deletions
  1. 4
    5
      beuty.py
  2. 4
    3
      main.py
  3. 4
    5
      selection.py
  4. 2
    1
      semantico.py

+ 4
- 5
beuty.py View File

@@ -1,5 +1,8 @@
1
+from bs4 import BeautifulSoup
2
+import os
3
+import pickle
4
+
1 5
 def beut(tabela1, tabela2):
2
-    from bs4 import BeautifulSoup
3 6
     with open('tabela.html', 'r') as file:
4 7
         soup = BeautifulSoup(file, "html5lib")
5 8
         soup.prettify()#reorganiza as tags
@@ -28,7 +31,6 @@ def separar(palavra):
28 31
     return (''.join(numero))
29 32
 
30 33
 def initsintatico(token, args,erro):
31
-    import os
32 34
     if not(os.path.isfile('dicionario1.dtc')and os.path.isfile('dicionario2.dtc')):
33 35
         save()
34 36
 
@@ -38,10 +40,8 @@ def initsintatico(token, args,erro):
38 40
     analisadorsintatico(dict_tabela1, dict_tabela2, token, args,erro)
39 41
 
40 42
 def load(filename):
41
-    import pickle
42 43
     file = open(filename, "rb")
43 44
     return pickle.load(file)
44
-
45 45
 def save():
46 46
     tabela1 = []
47 47
     tabela2 = []
@@ -65,7 +65,6 @@ def save():
65 65
     saveFile(dict_tabela2, "dicionario2.dtc")
66 66
 
67 67
 def saveFile(dict, filename):
68
-    import pickle
69 68
     dicionario = open(filename, "wb")
70 69
     pickle.dump(dict, dicionario)
71 70
     dicionario.close()

+ 4
- 3
main.py View File

@@ -1,3 +1,7 @@
1
+import sys
2
+import argparse
3
+from selection import opction
4
+
1 5
 def main():
2 6
 
3 7
     parser = argparse.ArgumentParser(description='Compilador para uma linguagem do tipo LL(1)')
@@ -12,7 +16,4 @@ def main():
12 16
 
13 17
 #executa a funcao main()
14 18
 if __name__ == "__main__":
15
-    import sys
16
-    import argparse
17
-    from selection import opction
18 19
     main()

+ 4
- 5
selection.py View File

@@ -1,3 +1,7 @@
1
+from lexical import tokenize
2
+from beuty import initsintatico
3
+from semantico import semantico
4
+from  Geracaodecodigo import gerarcodigo
1 5
 def opction(args):
2 6
     token = []
3 7
     erro = []
@@ -21,7 +25,6 @@ def opction(args):
21 25
         lgc(token, args)
22 26
 
23 27
 def vlt(filename,token,args, erro):
24
-    from lexical import tokenize
25 28
     print ('#' * 80)
26 29
     file = open(filename, "r")
27 30
     arquivo = file.read()
@@ -34,18 +37,14 @@ def vlt(filename,token,args, erro):
34 37
               '{:10}'.format(token[i][3]))
35 38
         i += 1
36 39
 def lt(filename, token, args, erro):
37
-    from lexical import tokenize
38 40
     file = open(filename, "r")
39 41
     arquivo = file.read()
40 42
     file.close()
41 43
     for tok in tokenize(arquivo,args,erro):
42 44
         token.append(tok)
43 45
 def ls(token,args,erro):
44
-    from beuty import initsintatico
45 46
     initsintatico(token,args,erro)
46 47
 def lse(token,args,erro):
47
-    from semantico import semantico
48 48
     semantico(token,args,erro)
49 49
 def lgc(token,args):
50
-    from  Geracaodecodigo import gerarcodigo
51 50
     gerarcodigo(token,args)

+ 2
- 1
semantico.py View File

@@ -1,3 +1,5 @@
1
+import re
2
+
1 3
 def semantico(token, args, erro):
2 4
     Avariaveis(token, args,erro)
3 5
 def divisao(token, args, lista,erro):
@@ -45,7 +47,6 @@ def verificando(variavel, linha, lista,erro):
45 47
     return 0
46 48
 
47 49
 def trocandoValores(lista,a,key):
48
-    import re
49 50
     for exp in lista.keys():
50 51
         if exp in a:
51 52
             a=re.sub(r''+exp, (''.join(lista[exp])),''.join(a))

Loading…
Cancel
Save