菜谱项目

math.test 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. Mathematical operators
  2. -----
  3. <?php
  4. // unary ops
  5. ~$a;
  6. +$a;
  7. -$a;
  8. // binary ops
  9. $a & $b;
  10. $a | $b;
  11. $a ^ $b;
  12. $a . $b;
  13. $a / $b;
  14. $a - $b;
  15. $a % $b;
  16. $a * $b;
  17. $a + $b;
  18. $a << $b;
  19. $a >> $b;
  20. $a ** $b;
  21. // associativity
  22. $a * $b * $c;
  23. $a * ($b * $c);
  24. // precedence
  25. $a + $b * $c;
  26. ($a + $b) * $c;
  27. // pow is special
  28. $a ** $b ** $c;
  29. ($a ** $b) ** $c;
  30. -----
  31. array(
  32. 0: Expr_BitwiseNot(
  33. expr: Expr_Variable(
  34. name: a
  35. )
  36. comments: array(
  37. 0: // unary ops
  38. )
  39. )
  40. 1: Expr_UnaryPlus(
  41. expr: Expr_Variable(
  42. name: a
  43. )
  44. )
  45. 2: Expr_UnaryMinus(
  46. expr: Expr_Variable(
  47. name: a
  48. )
  49. )
  50. 3: Expr_BinaryOp_BitwiseAnd(
  51. left: Expr_Variable(
  52. name: a
  53. comments: array(
  54. 0: // binary ops
  55. )
  56. )
  57. right: Expr_Variable(
  58. name: b
  59. )
  60. comments: array(
  61. 0: // binary ops
  62. )
  63. )
  64. 4: Expr_BinaryOp_BitwiseOr(
  65. left: Expr_Variable(
  66. name: a
  67. )
  68. right: Expr_Variable(
  69. name: b
  70. )
  71. )
  72. 5: Expr_BinaryOp_BitwiseXor(
  73. left: Expr_Variable(
  74. name: a
  75. )
  76. right: Expr_Variable(
  77. name: b
  78. )
  79. )
  80. 6: Expr_BinaryOp_Concat(
  81. left: Expr_Variable(
  82. name: a
  83. )
  84. right: Expr_Variable(
  85. name: b
  86. )
  87. )
  88. 7: Expr_BinaryOp_Div(
  89. left: Expr_Variable(
  90. name: a
  91. )
  92. right: Expr_Variable(
  93. name: b
  94. )
  95. )
  96. 8: Expr_BinaryOp_Minus(
  97. left: Expr_Variable(
  98. name: a
  99. )
  100. right: Expr_Variable(
  101. name: b
  102. )
  103. )
  104. 9: Expr_BinaryOp_Mod(
  105. left: Expr_Variable(
  106. name: a
  107. )
  108. right: Expr_Variable(
  109. name: b
  110. )
  111. )
  112. 10: Expr_BinaryOp_Mul(
  113. left: Expr_Variable(
  114. name: a
  115. )
  116. right: Expr_Variable(
  117. name: b
  118. )
  119. )
  120. 11: Expr_BinaryOp_Plus(
  121. left: Expr_Variable(
  122. name: a
  123. )
  124. right: Expr_Variable(
  125. name: b
  126. )
  127. )
  128. 12: Expr_BinaryOp_ShiftLeft(
  129. left: Expr_Variable(
  130. name: a
  131. )
  132. right: Expr_Variable(
  133. name: b
  134. )
  135. )
  136. 13: Expr_BinaryOp_ShiftRight(
  137. left: Expr_Variable(
  138. name: a
  139. )
  140. right: Expr_Variable(
  141. name: b
  142. )
  143. )
  144. 14: Expr_BinaryOp_Pow(
  145. left: Expr_Variable(
  146. name: a
  147. )
  148. right: Expr_Variable(
  149. name: b
  150. )
  151. )
  152. 15: Expr_BinaryOp_Mul(
  153. left: Expr_BinaryOp_Mul(
  154. left: Expr_Variable(
  155. name: a
  156. comments: array(
  157. 0: // associativity
  158. )
  159. )
  160. right: Expr_Variable(
  161. name: b
  162. )
  163. comments: array(
  164. 0: // associativity
  165. )
  166. )
  167. right: Expr_Variable(
  168. name: c
  169. )
  170. comments: array(
  171. 0: // associativity
  172. )
  173. )
  174. 16: Expr_BinaryOp_Mul(
  175. left: Expr_Variable(
  176. name: a
  177. )
  178. right: Expr_BinaryOp_Mul(
  179. left: Expr_Variable(
  180. name: b
  181. )
  182. right: Expr_Variable(
  183. name: c
  184. )
  185. )
  186. )
  187. 17: Expr_BinaryOp_Plus(
  188. left: Expr_Variable(
  189. name: a
  190. comments: array(
  191. 0: // precedence
  192. )
  193. )
  194. right: Expr_BinaryOp_Mul(
  195. left: Expr_Variable(
  196. name: b
  197. )
  198. right: Expr_Variable(
  199. name: c
  200. )
  201. )
  202. comments: array(
  203. 0: // precedence
  204. )
  205. )
  206. 18: Expr_BinaryOp_Mul(
  207. left: Expr_BinaryOp_Plus(
  208. left: Expr_Variable(
  209. name: a
  210. )
  211. right: Expr_Variable(
  212. name: b
  213. )
  214. )
  215. right: Expr_Variable(
  216. name: c
  217. )
  218. )
  219. 19: Expr_BinaryOp_Pow(
  220. left: Expr_Variable(
  221. name: a
  222. comments: array(
  223. 0: // pow is special
  224. )
  225. )
  226. right: Expr_BinaryOp_Pow(
  227. left: Expr_Variable(
  228. name: b
  229. )
  230. right: Expr_Variable(
  231. name: c
  232. )
  233. )
  234. comments: array(
  235. 0: // pow is special
  236. )
  237. )
  238. 20: Expr_BinaryOp_Pow(
  239. left: Expr_BinaryOp_Pow(
  240. left: Expr_Variable(
  241. name: a
  242. )
  243. right: Expr_Variable(
  244. name: b
  245. )
  246. )
  247. right: Expr_Variable(
  248. name: c
  249. )
  250. )
  251. )