1 descent@debianlinux:simple_compiler$ cat test_pattern/p2 2 int a; 3 4 int f2(int i) 5 { 6 1+2; 7 a=3; 8 return 2+5+i+a; 9 } 10 11 int main() 12 { 13 int x,y; 14 int a; 15 16 a=99; 17 printf("a: %d\n", a); 18 19 y=2; 20 x = f2(y+1); 21 22 printf("f2(): %d\n", x); 23 } 24 25 26 descent@debianlinux:simple_compiler$ ./c_parser < test_pattern/p2 27 xx return 28 expr return 29 STRING: a: %d 30 31 STRING: f2(): %d 32 33 \tree( root( prog( g_var(a |int |global))( f2 |int |func( para(i |int))( func_body( +(1)(2))( =(a)(3))( return( +( +( +(2)(5))(i))(a)))))( main |int |func( func_body( var(x |int)(y |int))( var(a |int))( =(a)(99))( printf(a: \%d\\n)(a))( =(y)(2))( =(x)( f2( +(y)(1))))( printf(f2\(\): \%d\\n)(x))))(main))) 34 op: root 35 can not handle op: f2, ast type: NAME 36 can not handle op: main, ast type: NAME 37 a: 99 38 f2(): 13
沒有留言:
張貼留言