Browse Source

Add files via upload

Nicolas T. Cuerbas 6 years ago
parent
commit
553be4c5d2
No account linked to committer's email address
3 changed files with 3 additions and 3 deletions
  1. 1
    1
      Geracaodecodigo.py
  2. 1
    1
      fatorial.txt
  3. 1
    1
      intermediario.s

+ 1
- 1
Geracaodecodigo.py View File

@@ -24,7 +24,7 @@ def intemerdiario(token,args, inicio, fim, loop,condicional, texto):
24 24
             L=L+i
25 25
             C=L
26 26
         elif 'se' == token[i][0]:
27
-            texto.append(f'_C{C} if {token[i+2][1]} {token[i+3][1]} {token[i+4][1]} goto _C{C+1}')
27
+            texto.append(f'_C{C}: if {token[i+2][1]}' + (' >' if '<' in token[i+3][1] else ' <')+f' {token[i+4][1]} goto _C{C+1}')
28 28
             i=intemerdiario(token, args, i+6, fim, L, C+1, texto)
29 29
             texto.append(f'_C{L+1}:')
30 30
             C = C + i

+ 1
- 1
fatorial.txt View File

@@ -2,7 +2,7 @@ programa
2 2
 inteiro var1, var2;
3 3
 escreva("Escreva um numero: ");
4 4
 leia(var1);
5
-var2 = 1;
5
+var2 = (- 1);
6 6
 se(1<1){
7 7
     enquanto(var1 > 1){
8 8
         var2 = var1 / var2 * 1 + 2;

+ 1
- 1
intermediario.s View File

@@ -3,7 +3,7 @@ INTEIRO var2
3 3
 ESCREVA "Escreva um numero: "
4 4
 LEIA var1
5 5
 var2 := 1
6
-_C0 if 1 < 1 goto _C1
6
+_C0: if 1 > 1 goto _C1
7 7
 _L0: if var1 < 1 goto _L1 
8 8
 T1 := var1 var2 /
9 9
 T2 := T1 1 *

Loading…
Cancel
Save