1 int main() 2 { 3 int i; 4 int j; 5 6 //i=23; 7 //j=5678; 8 //printf("i = %d\n", i+j); 9 //printf("j = %d\n", j); 10 i=2; 11 j=1; 12 //printf("i+j = %d\n", i+j); 13 14 printf("i = %d\n", i); 15 printf("j = %d\n", j); 16 //printf("i+5 = %d\n", i+5); 17 printf("5+i = %d\n", 5+i); 18 19 //(1+2)+((3+4)+(5+6)); 20 //printf("1+2 = %d\n", 1+2); 21 //printf("(1+2)+(3+4) = %d\n", (1+2)+(3+4)); 22 //printf("1+2*3 = %d\n", 1+2*3); 23 //printf("xx 5*(6+7) = %d\n", 5*(6+7)); 24 //printf("yy %d\n", 1+2); 25 //(2*3*4) * (5*(7*(8*9))); 26 // (2*3)*(5*6); 27 28 //3*9; 29 //4*(2*3); 30 //2-1-6; 31 32 // toplevel if (child[0]->is_leaf() && child[1]->is_leaf() != true) 33 // toplevel if (child[0]->is_leaf() != true && child[1]->is_leaf()) 34 //1+2+5; 35 //5+(1+2); 36 37 //printf("%d\n", (1+2+3)+ (5+6+7)+(9+10)); 38 39 // if (child[0]->is_leaf() != true && child[1]->is_leaf()) 40 //(9+10) + ((1+2+3)+ (5+6+7)); 41 //(1+2)+9+(3+5)+(7+8); 42 43 // (child[0]->is_leaf() && child[1]->is_leaf() != true) 44 //(3+(5+6)+9) + (1+2); 45 //(1+2) + (9 + (3 +(5+6))); 46 47 //(1+2)+(3+4+5); 48 //(1+2)+(3+4)+(5+6) + (7+8); 49 50 //1+2+3+4+5; 51 //1+2; 52 //1+(2+3); 53 //1+2+3; 54 //(1+2)+(3+4); 55 }
1 .section .rodata 2 .LC1: 3 .string "i = %d\n" 4 .section .rodata 5 .LC2: 6 .string "j = %d\n" 7 .section .rodata 8 .LC3: 9 .string "5+i = %d\n" 10 .text 11 .globl main 12 .type main, @function 13 main: 14 pushl %ebp 15 movl %esp, %ebp 16 subl $4, %esp # reserve temp object size 17 subl $8, %esp # reserve local variable 18 mov $2 ,%eax 19 movl %eax, (%ebp) 20 mov $1 ,%eax 21 movl %eax, -4(%ebp) 22 pushl (%ebp) 23 pushl $.LC1 24 call printf 25 addl $8, %esp 26 pushl -4(%ebp) 27 pushl $.LC2 28 call printf 29 addl $8, %esp 30 movl $5, %eax 31 ADD (%ebp), %eax 32 pushl %eax 33 popl %eax 34 pushl %eax 35 pushl $.LC3 36 call printf 37 addl $8, %esp 38 leave 39 ret
沒有留言:
張貼留言