| Higher Subleq | Error | Output | Subleq | ITR |
char a[]="Hello, World!\n";
char * q = a;
int putchar(int x);
int main()
{
char * p = a;
start1:
if( *p )
{
putchar(*p);
p = p+1;
goto start1;
}
start2:
if( *q )
{
putchar(*q);
q = q+1;
goto start2;
}
{
int i=0;
start3:
if( a[i] )
{
putchar(a[i]);
i = i+1;
goto start3;
}
}
}
|
|
Hello, World!
Hello, World!
Hello, World!
|
top:top top sqmain
. _a:72 101 108 108 111 44 32 87 111 114 108 100 33 10 0
. _q:_a
_main:
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; bp 0
bp; sp bp
c4 sp
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; t1 0
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; t2 0
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; t3 0
t1; t2; bp t1; dec t1; t1 t2
?+23; ?+21; ?+24; t2 Z; Z ?+10; Z ?+8
Z ?+11; Z; 0; c1 Z; Z 0; Z
l_main_start1:
t1; t2; bp t1; dec t1; t1 t2
t1; t3; ?+11; t2 Z; Z ?+4; Z; 0 t1; t1 t3
t2; t1; ?+11; t3 Z; Z ?+4; Z; 0 t2; t2 t1
t3; t1 Z; Z t3 ?+3; Z Z ?+9; Z; t1 t3; t1 t3
Z t3 l1
t1; t2; bp t1; dec t1; t1 t2
t1; t3; ?+11; t2 Z; Z ?+4; Z; 0 t1; t1 t3
t2; t1; ?+11; t3 Z; Z ?+4; Z; 0 t2; t2 t1
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+9; sp ?+5; t1 Z; Z 0; Z
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; ?+2 0 _putchar; . ?;
c2 sp
t1; t2; bp t1; dec t1; t1 t2
t1; t3; ?+11; t2 Z; Z ?+4; Z; 0 t1; t1 t3
t2; t1; t3 t2; dec t2; t2 t1
t2; t3; bp t2; dec t2; t2 t3
?+23; ?+21; ?+24; t3 Z; Z ?+10; Z ?+8
Z ?+11; Z; 0; t1 Z; Z 0; Z
Z Z l_main_start1
l1:
l_main_start2:
t1; t2; ?+11; _q Z; Z ?+4; Z; 0 t1; t1 t2
t1; t2 Z; Z t1 ?+3; Z Z ?+9; Z; t2 t1; t2 t1
Z t1 l2
t1; t2; ?+11; _q Z; Z ?+4; Z; 0 t1; t1 t2
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+9; sp ?+5; t2 Z; Z 0; Z
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; ?+2 0 _putchar; . ?;
c2 sp
t1; t2; _q t1; dec t1; t1 t2
_q; t2 Z; Z _q; Z
Z Z l_main_start2
l2:
t1; t2; bp t1; c4 t1; t1 t2
?+23; ?+21; ?+24; t2 Z; Z ?+10; Z ?+8
Z ?+11; Z; 0; c3 Z; Z 0; Z
l_main_start3:
t1; t2; bp t1; c4 t1; t1 t2
t1; t3; ?+11; t2 Z; Z ?+4; Z; 0 t1; t1 t3
t2; t1; c1 t2; t3 t2; t2 t1
t2; t3; ?+11; t1 Z; Z ?+4; Z; 0 t2; t2 t3
t1; t3 Z; Z t1 ?+3; Z Z ?+9; Z; t3 t1; t3 t1
Z t1 l3
t1; t2; bp t1; c4 t1; t1 t2
t1; t3; ?+11; t2 Z; Z ?+4; Z; 0 t1; t1 t3
t2; t1; c1 t2; t3 t2; t2 t1
t2; t3; ?+11; t1 Z; Z ?+4; Z; 0 t2; t2 t3
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+9; sp ?+5; t3 Z; Z 0; Z
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; ?+2 0 _putchar; . ?;
c2 sp
t1; t2; bp t1; c4 t1; t1 t2
t1; t3; ?+11; t2 Z; Z ?+4; Z; 0 t1; t1 t3
t2; t1; t3 t2; dec t2; t2 t1
t2; t3; bp t2; c4 t2; t2 t3
?+23; ?+21; ?+24; t3 Z; Z ?+10; Z ?+8
Z ?+11; Z; 0; t1 Z; Z 0; Z
Z Z l_main_start3
l3:
?+8; sp ?+4; t3; 0 t3; inc sp
?+8; sp ?+4; t2; 0 t2; inc sp
?+8; sp ?+4; t1; 0 t1; inc sp
sp; bp sp
?+8; sp ?+4; bp; 0 bp; inc sp
?+8; sp ?+4; ?+7; 0 ?+3; Z Z 0
_putchar:
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; bp 0
bp; sp bp
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; t1 0
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; t2 0
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; t3 0
t1; t2; bp t1; c2 t1; t1 t2
t1; t3; ?+11; t2 Z; Z ?+4; Z; 0 t1; t1 t3
t3 (-1)
ax; t3 ax
Z Z end_putchar
end_putchar:
?+8; sp ?+4; t3; 0 t3; inc sp
?+8; sp ?+4; t2; 0 t2; inc sp
?+8; sp ?+4; t1; 0 t1; inc sp
sp; bp sp
?+8; sp ?+4; bp; 0 bp; inc sp
?+8; sp ?+4; ?+7; 0 ?+3; Z Z 0
sqmain:
dec sp; ?+11; sp ?+7; ?+6; sp ?+2; 0
?+6; sp ?+2; ?+2 0 _main; . ?; inc sp
Z Z (-1)
. c2:-2 c3:0 c4:2 c1:_a
. t1:0 t2:0 t3:0
. inc:-1 Z:0 dec:1 ax:0 bp:0 sp:-sp
|
Root (ex062.hsq:36)
Declaration (ex062.hsq:1)
Keyword [char] (ex062.hsq:1)
Declarator ["] (ex062.hsq:1)
Id [a] (ex062.hsq:1)
String [Hello, World!.] (ex062.hsq:1)
Declaration (ex062.hsq:2)
Keyword [char] (ex062.hsq:2)
Declarator [=] (ex062.hsq:2)
Id [q] (ex062.hsq:2)
Label [a] (ex062.hsq:2) ":1
Function:0 [putchar] (ex062.hsq:3)
Keyword [int] (ex062.hsq:3)
Param-type-list (ex062.hsq:3)
Stackvar:-2 [x] (ex062.hsq:3)
Function:2 [main] (ex062.hsq:4)
Keyword [int] (ex062.hsq:4)
Param-type-list (ex062.hsq:4)
Block (ex062.hsq:5)
Declaration (ex062.hsq:6)
Keyword [char] (ex062.hsq:6)
Declarator [=] (ex062.hsq:6)
Stackvar:1 [p] (ex062.hsq:6)
Label [a] (ex062.hsq:6) ":1
Label-statement [start1] (ex062.hsq:8)
Keyword-statement [if] (ex062.hsq:9)
Equality [!=] (ex062.hsq:9)
Unary [*] (ex062.hsq:9)
Unary [*] (ex062.hsq:9) p:6
Additive [+] (ex062.hsq:9) p:6
Variable [@bp] (ex062.hsq:9) p:6
Const [1] (ex062.hsq:9) p:6
Const [0] (ex062.hsq:9)
Block (ex062.hsq:10)
Postfix [(] (ex062.hsq:11)
Label [putchar] (ex062.hsq:11)
Expression-list (ex062.hsq:11)
Unary [*] (ex062.hsq:11)
Unary [*] (ex062.hsq:11) p:6
Additive [+] (ex062.hsq:11) p:6
Variable [@bp] (ex062.hsq:11) p:6
Const [1] (ex062.hsq:11) p:6
Assignment [=] (ex062.hsq:12)
Unary [*] (ex062.hsq:12) p:6
Additive [+] (ex062.hsq:12) p:6
Variable [@bp] (ex062.hsq:12) p:6
Const [1] (ex062.hsq:12) p:6
Additive [+] (ex062.hsq:12)
Unary [*] (ex062.hsq:12) p:6
Additive [+] (ex062.hsq:12) p:6
Variable [@bp] (ex062.hsq:12) p:6
Const [1] (ex062.hsq:12) p:6
Const [1] (ex062.hsq:12)
Keyword-statement [goto] (ex062.hsq:13)
Label [start1] (ex062.hsq:13) start1:8
Label-statement [start2] (ex062.hsq:16)
Keyword-statement [if] (ex062.hsq:17)
Equality [!=] (ex062.hsq:17)
Unary [*] (ex062.hsq:17)
Variable [q] (ex062.hsq:17) =:2
Const [0] (ex062.hsq:17)
Block (ex062.hsq:18)
Postfix [(] (ex062.hsq:19)
Label [putchar] (ex062.hsq:19) putchar:1
Expression-list (ex062.hsq:19)
Unary [*] (ex062.hsq:19)
Variable [q] (ex062.hsq:19) =:2
Assignment [=] (ex062.hsq:20)
Variable [q] (ex062.hsq:20) =:2
Additive [+] (ex062.hsq:20)
Variable [q] (ex062.hsq:20) =:2
Const [1] (ex062.hsq:20)
Keyword-statement [goto] (ex062.hsq:21)
Label [start2] (ex062.hsq:21) start2:16
Block (ex062.hsq:24)
Declaration (ex062.hsq:25)
Keyword [int] (ex062.hsq:25)
Declarator [=] (ex062.hsq:25)
Stackvar:2 [i] (ex062.hsq:25)
Const [0] (ex062.hsq:25)
Label-statement [start3] (ex062.hsq:26)
Keyword-statement [if] (ex062.hsq:27)
Equality [!=] (ex062.hsq:27)
Unary [*] (ex062.hsq:27)
Additive [+] (ex062.hsq:27)
Label [a] (ex062.hsq:27) ":1
Unary [*] (ex062.hsq:27) i:25
Additive [+] (ex062.hsq:27) i:25
Variable [@bp] (ex062.hsq:27) i:25
Const [2] (ex062.hsq:27) i:25
Const [0] (ex062.hsq:27)
Block (ex062.hsq:28)
Postfix [(] (ex062.hsq:29)
Label [putchar] (ex062.hsq:29) putchar:1
Expression-list (ex062.hsq:29)
Unary [*] (ex062.hsq:29)
Additive [+] (ex062.hsq:29)
Label [a] (ex062.hsq:29) ":1
Unary [*] (ex062.hsq:29) i:25
Additive [+] (ex062.hsq:29) i:25
Variable [@bp] (ex062.hsq:29) i:25
Const [2] (ex062.hsq:29) i:25
Assignment [=] (ex062.hsq:30)
Unary [*] (ex062.hsq:30) i:25
Additive [+] (ex062.hsq:30) i:25
Variable [@bp] (ex062.hsq:30) i:25
Const [2] (ex062.hsq:30) i:25
Additive [+] (ex062.hsq:30)
Unary [*] (ex062.hsq:30) i:25
Additive [+] (ex062.hsq:30) i:25
Variable [@bp] (ex062.hsq:30) i:25
Const [2] (ex062.hsq:30) i:25
Const [1] (ex062.hsq:30)
Keyword-statement [goto] (ex062.hsq:31)
Label [start3] (ex062.hsq:31) start3:26
Function:0 [putchar] (::putchar:1)
Keyword [int] (::putchar:1)
Param-type-list (::putchar:1)
Stackvar:-2 [x] (::putchar:1)
Block (::putchar:2)
Keyword-statement [return] (::putchar:3)
OperatorIO [__out] (::putchar:3)
Unary [*] (::putchar:3) x:1
Additive [+] (::putchar:3) x:1
Variable [@bp] (::putchar:3) x:1
Const [-2] (::putchar:3) x:1
|