summaryrefslogtreecommitdiff
path: root/testsuite/tests/programs/joao-circular/joao-circular.stdout
blob: 0c69f85dbc21db7ef12d1eb01763904f4a64b855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
["inp","40"]
Pretty Printed Input:
Int = a
Int = b
Int = c
Int = a
fact(Int x,) : Int
{  fact = 1;
   while x > 0fact = fact * x;
              x = x - 1;;
}
recfact(Int x,) : Int
{  if(x == 0)then{  recfact = 1;
                 }
   else{  recfact = x * recfact(x - 1);
       };
}
MSP Generated Code:
MEMORIA DE DADOS
"a0"  TAM 1
"b0"  TAM 1
"c0"  TAM 1
"a0"  TAM 1
"fact0"  TAM 1
"x"  TAM 1
"recfact1"  TAM 1
"x"  TAM 2
CODIGO
CALL "main"
HALT
C_Ident_1 "fact":
PUSHa "fact" 1
PUSHi 1
STORE
C_Ident_1 "while_1":
PUSHa "x" 1
LOAD
PUSHi 0
GT
JMPF "end_while_1"
PUSHa "fact" 1
PUSHa "fact" 1
LOAD
PUSHa "x" 1
LOAD
MUL
STORE
PUSHa "x" 1
PUSHa "x" 1
LOAD
PUSHi 1
SUB
STORE
JMP "while_1"
C_Ident_1 "end_while_1":
RET
C_Ident_1 "recfact":
PUSHa "x" 2
LOAD
PUSHi 0
EQ
JMPF "else_1"
PUSHa "recfact" 2
PUSHi 1
STORE
JMPF "end_if_1"
C_Ident_1 "else_1":
PUSHa "recfact" 2
PUSHa "x" 2
LOAD
PUSHa "x" 1
PUSHa "x" 2
LOAD
PUSHi 1
SUB
STORE
CALL "recfact"
MUL
STORE
C_Ident_1 "end_if_1":
RET


Detected Semantic Errors:
[C_E_Name_AD_1 (C_Ident_1 "a")]
[]