5d2c41a41b6e8763c34b8a5953ffc75203af02bb 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. compilation_unit {
  2. package_statement {
  3. package_name: "ExplorerTest"
  4. }
  5. is_api: true
  6. declarations {
  7. function {
  8. name {
  9. name: "Main"
  10. }
  11. param_pattern {
  12. }
  13. return_term {
  14. kind: Expression
  15. type {
  16. int_type_literal {
  17. }
  18. }
  19. }
  20. body {
  21. statements {
  22. variable_definition {
  23. pattern {
  24. binding_pattern {
  25. name: "x"
  26. type {
  27. expression_pattern {
  28. expression {
  29. int_type_literal {
  30. }
  31. }
  32. }
  33. }
  34. }
  35. }
  36. init {
  37. int_literal {
  38. value: 2
  39. }
  40. }
  41. is_returned: false
  42. }
  43. }
  44. statements {
  45. while_statement {
  46. condition {
  47. bool_literal {
  48. value: true
  49. }
  50. }
  51. body {
  52. statements {
  53. if_statement {
  54. condition {
  55. operator {
  56. op: Eq
  57. arguments {
  58. identifier {
  59. name: "x"
  60. }
  61. }
  62. arguments {
  63. int_literal {
  64. value: 0
  65. }
  66. }
  67. }
  68. }
  69. then_block {
  70. statements {
  71. break_statement {
  72. }
  73. }
  74. }
  75. else_block {
  76. statements {
  77. assign {
  78. lhs {
  79. identifier {
  80. name: "x"
  81. }
  82. }
  83. rhs {
  84. operator {
  85. op: Sub
  86. arguments {
  87. identifier {
  88. name: "x"
  89. }
  90. }
  91. arguments {
  92. int_literal {
  93. value: 1
  94. }
  95. }
  96. }
  97. }
  98. op: Plain
  99. }
  100. }
  101. }
  102. }
  103. }
  104. }
  105. }
  106. }
  107. statements {
  108. return_expression_statement {
  109. expression {
  110. identifier {
  111. name: "x"
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }
  119. }