Advertisement
snake5

new lang update: while, sizeof

Jan 18th, 2015
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.24 KB | None | 0 0
  1. /// CODE ///
  2. extern func dump( v : int64 );
  3.  
  4. func _test( a : int32 ) : int32
  5. {
  6.     var v : int8 = -5;
  7.     while( v < 0 )
  8.     {
  9.         dump( v + a );
  10.         v += 1;
  11.     }
  12.     return 0s8 + a + v;
  13. }
  14.  
  15. func main()
  16. {
  17.     dump( sizeof( uint16 ) );
  18.     dump( sizeof( 0s8 ) );
  19.     dump( sizeof( 0s64 ) );
  20.     dump( sizeof( 0f32 ) );
  21.     var dbl : float64;
  22.     dump( sizeof( dbl ) );
  23.    
  24.     dump( _test( 1 ) );
  25. }
  26. /// GENERATED C CODE ///
  27. Iint32 _Itest( Iint32 Ia )
  28. {
  29.     Iint8 Iv;
  30.     const Iuint8 I0 = 5;
  31.     Iint32 I1 = -I0;
  32.     Iv = I1;
  33. lbl_0:;
  34.     const Iuint8 I2 = 0;
  35.     Ibool I3 = Iv < I2;
  36.     if( !I3 ) goto lbl_1;
  37.     Iint32 I4 = Iv + Ia;
  38.     Idump( I4 );
  39.     const Iuint8 I5 = 1;
  40.     Iv = Iv + I5;
  41.     goto lbl_0;
  42. lbl_1:;
  43.     const Iint8 I6 = 0;
  44.     Iint32 I7 = I6 + Ia;
  45.     Iint32 I8 = I7 + Iv;
  46.     return I8;
  47. }
  48.  
  49. void Imain()
  50. {
  51.     Ifloat64 Idbl;
  52.     const Iint32 I0 = 2;
  53.     Idump( I0 );
  54.     const Iint8 I1 = 0;
  55.     const Iint32 I2 = 1;
  56.     Idump( I2 );
  57.     const Iint64 I3 = 0;
  58.     const Iint32 I4 = 8;
  59.     Idump( I4 );
  60.     const Ifloat32 I5 = 0.000000000000000000;
  61.     const Iint32 I6 = 4;
  62.     Idump( I6 );
  63.     const Iint32 I7 = 8;
  64.     Idump( I7 );
  65.     const Iuint8 I8 = 1;
  66.     Iint32 I9 = _Itest( I8 );
  67.     Idump( I9 );
  68. }
  69. /// OUTPUT ///
  70. int (2)
  71. int (1)
  72. int (8)
  73. int (4)
  74. int (8)
  75. int (-4)
  76. int (-3)
  77. int (-2)
  78. int (-1)
  79. int (0)
  80. int (1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement