Advertisement
snake5

new lang first app

Jan 17th, 2015
600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.14 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.     return 0s8 + a + v;
  8. }
  9.  
  10. func main()
  11. {
  12.     dump( _test( 1 ) );
  13. }
  14. /// BYTECODE ///
  15. FUNC (struct=6 op=30 opsub=0 tt=75)
  16. {
  17.   name = '_test'
  18.   bytecode:
  19.     DECLARG <int32> a [12]
  20.     DECLVAR <int8> v [9]
  21.     CONST <uint8> 0 [16] : 05
  22.     NEGATE <int32> 1 [18] <= 0 [16]
  23.     COPY <> v [9] <= 1 [18]
  24.     CONST <int8> 2 [19] : 00
  25.     ADD <int32> 3 [21] <= 2 [19], a [12]
  26.     ADD <int32> 4 [22] <= 3 [21], v [9]
  27.     RETURN 4 [22]
  28. }
  29. FUNC (struct=6 op=30 opsub=0 tt=75)
  30. {
  31.   name = 'main'
  32.   bytecode:
  33.     CONST <uint8> 0 [16] : 01
  34.     FCALL <int32> 1 [18] <= func:_test [11] args(1): 0 [16]
  35.     FCALL <>  [0] <= func:dump [8] args(1): 1 [18]
  36. }
  37. /// GENERATED C CODE ///
  38. extern void Idump( Iint64 Iv );
  39. Iint32 _Itest( Iint32 Ia );
  40. void Imain();
  41.  
  42. Iint32 _Itest( Iint32 Ia )
  43. {
  44.     Iint8 Iv;
  45.     const Iuint8 I0 = 5;
  46.     Iint32 I1 = -I0;
  47.      Iv = I1;
  48.     const Iint8 I2 = 0;
  49.     Iint32 I3 = I2 + Ia;
  50.     Iint32 I4 = I3 + Iv;
  51.     return I4;
  52. }
  53.  
  54. void Imain()
  55. {
  56.     const Iuint8 I0 = 1;
  57.     Iint32 I1 = _Itest( I0 );
  58.     Idump( I1 );
  59. }
  60. /// OUTPUT ///
  61. int (-4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement