正在加载图片...
How about some TAC that implements control structures, for example, such the if statement below? void main()( main a=23; u20 if 23 t1=23; e⊥se Ifz t2 Goto Lo t3=10 t4=19 t4 Endfunc Or the even snazzier while loop(for loops are left an exercise for the reader) void maino( int ai BeginFunc; t0=0 while (a< 10)i Print(a暑2 0); t1=10 +1 t1 工 z34 2 Goto Lli 5=0 t6 t4==t5; Pushparam t6 LCall PrintBool t8 = a+ t7 a L17 How about some TAC that implements control structures, for example, such the if statement below? void main() { int a; a = 23; if (a == 23) a = 10; else a = 19; } main: BeginFunc; _t0 = 23; a = _t0; _t1 = 23; _t2 = a == _t1; IfZ _t2 Goto _L0; _t3 = 10; a = _t3; Goto _L1; _L0: _t4 = 19; a = _t4; _L1: EndFunc; Or the even snazzier while loop (for loops are left an exercise for the reader): void main() { int a; a = 0; while (a < 10) { Print(a % 2 == 0); a = a + 1; } } main: BeginFunc; _t0 = 0; a = _t0; _L0: _t1 = 10; _t2 = a < _t1; IfZ _t2 Goto _L1; _t3 = 2; _t4 = a % _t3; _t5 = 0; _t6 = _t4 == _t5; PushParam _t6; LCall _PrintBool; _t7 = 1; _t8 = a + _t7; a = _t8; Goto _L0; _L1: EndFunc;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有