The Sol Programming Language!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_out.txt 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. --- Empty functions
  2. None
  3. --- While loop
  4. 1
  5. 2
  6. 3
  7. 4
  8. 5
  9. 6
  10. 7
  11. 8
  12. 9
  13. --- Range
  14. [0, 1, 2, 3, 4]
  15. --- Iter list
  16. 1
  17. 2
  18. 3
  19. 4
  20. 5
  21. --- Index list
  22. 0 1
  23. 1 2
  24. 2 3
  25. 3 4
  26. 4 5
  27. --- mul9
  28. 9
  29. 18
  30. 27
  31. 36
  32. 45
  33. --- Iter mul9
  34. 0 9
  35. 1 18
  36. 2 27
  37. 3 36
  38. 4 45
  39. --- Mapgen
  40. {[10] = ... (0x1409410), [6] = ... (0x1409310), ["this time with spaces"] = 6.283185, ["sublist"] = [1, ... (0x14091d0), 2, 3, 5, 8], ["submap"] = {["health"] = 42.000000, ["stamina"] = 100}, ["string"] = "hello", ["integer"] = ... (0x14091d0)}
  41. --- Map iter
  42. 10 10
  43. 6 6
  44. this time with spaces 6.283185
  45. sublist [1, ... (0x14091d0), 2, 3, 5, 8]
  46. submap {["health"] = 42.000000, ["stamina"] = 100}
  47. string hello
  48. integer 1
  49. --- try
  50. {["c"] = <Function>}
  51. [1, 15]
  52. {}
  53. [0, "Undefined method (call on singlet)", [[<Stmt[LIST]>, {["bad"] = <Function bad>, ["x"] = {}}], [<Stmt[RET]>, ... (0x145db20)]]]
  54. {["c"] = <Function>}
  55. 15
  56. --- Induced errors
  57. [0, "lp0 on fire", [[<Stmt[LIST]>, {["raise"] = <Function raise>, ["x"] = ... (0x145e2c0)}], [<Stmt[EXPR]>, ... (0x145f060)]]]
  58. --- Indexing
  59. 1
  60. 1
  61. 6
  62. --- Function binding
  63. 8 9 10
  64. 11 12 13
  65. --- Iterators
  66. 1
  67. 2
  68. 3
  69. 4
  70. 5
  71. 6
  72. 7
  73. 8
  74. 9
  75. 10
  76. --- Method calls
  77. 1 2
  78. {["a"] = <Function>} 3
  79. --- Special methods
  80. Index {["__call"] = <Function>, ["__setindex"] = <Function>, ["__index"] = <Function>} 3
  81. Index {["__call"] = <Function>, ["__setindex"] = <Function>, ["__index"] = <Function>} 5
  82. 3 5
  83. SetIndex {["__call"] = <Function>, ["__setindex"] = <Function>, ["__index"] = <Function>} a 7
  84. Call {["__call"] = <Function>, ["__setindex"] = <Function>, ["__index"] = <Function>} q r
  85. q
  86. {["__setindex"] = {["b"] = 2, ["a"] = 1}, ["__index"] = ... (0x1464400)} 1 2
  87. {["__setindex"] = {["b"] = 2, ["a"] = 1}, ["__index"] = ... (0x1464400)} {... (0x1465400), ... (0x1465140)}
  88. --- Data sharing
  89. {["b"] = [1, 2, 3, 4, 5], ["a"] = ... (0x1465980)}
  90. {["b"] = [1, 2, 7, "c", 5], ["a"] = ... (0x1465980)}
  91. {["b"] = [1, 7, "c", "f", "q"], ["a"] = ... (0x1465980)}
  92. --- Arithmetic structure operations
  93. abcd
  94. lolololololololololololololololololololololololololololololololol
  95. [1, 2, 3, 4, 5]
  96. [1, 2, 3, ... (0x14091d0), ... (0x1409210), ... (0x1409250), ... (0x14091d0), ... (0x1409210), ... (0x1409250), ... (0x14091d0), ... (0x1409210), ... (0x1409250), ... (0x14091d0), ... (0x1409210), ... (0x1409250)]
  97. {["c"] = 3, ["b"] = 2, ["a"] = 1}
  98. --- Map/filter
  99. [1, 2, 3, 4, 5]
  100. [3, 6, 9, 12, 15]
  101. [3, 9, 15]
  102. --- Map/filter chain
  103. [3, 9, 15]
  104. --- Exec/eval
  105. Hello from exec!
  106. 8
  107. Hello from subtest!
  108. --- Modulus
  109. 2
  110. 3
  111. 0
  112. --- Special function manipulation
  113. <Function foo>
  114. <Function bar>
  115. [1, 2, 3]
  116. ["b", 1, 2, 3]
  117. --- Function body swapping
  118. <Function a> 0
  119. <Function b> 2
  120. <Stmt[LIST]>
  121. <Stmt[LIST]>
  122. <Function a> 2
  123. <Function b> 0
  124. <Stmt[LIST]>
  125. <Function a> 4
  126. <Function b> 4
  127. --- More complicated ASTs
  128. <Function outer> <Stmt[LIST]> [<Stmt[EXPR]>, <Stmt[EXPR]>, <Stmt[RET]>]
  129. --- Exec- and eval-by-parse
  130. Hello from parse()!
  131. 8
  132. --- Mutating ASTs
  133. <Function f> <Stmt[LIST]> 12
  134. <Function f> <Stmt[LIST]> 12
  135. a= 1 , b= 2
  136. <Function g> <Stmt[LIST]> None
  137. a= 1 , b= 2
  138. <Function g> <Stmt[LIST]> None
  139. --- AST Environments
  140. "<Stmt[LIST]>
  141. a is <Function a> and b is <Function b>
  142. {["b"] = 2, ["a"] = 1}
  143. a is 1 and b is 2
  144. {["b"] = 5, ["a"] = 4}
  145. {["b"] = ["world"], ["a"] = "hello"}
  146. a is hello and b is ["world"]
  147. {["b"] = 5, ["a"] = 4}
  148. {["__index"] = {["b"] = 2, ["a"] = 1}}
  149. {["b"] = 2, ["a"] = 1}
  150. a is 1 and b is 2
  151. {["b"] = 5, ["a"] = 4, ["__index"] = {["b"] = 2, ["a"] = 1}}
  152. {["b"] = 2, ["a"] = 1}
  153. --- Basic buffers
  154. (buffer.fromstring = <CFunction> )
  155. <Buffer @0x1474380 size 14
  156. (b.get = <CFunction> )
  157. Hello, world!
  158. QeLlo, world!
  159. , world!
  160. 1816946001
  161. 1886545252
  162. derpo, world!
  163. derpo, world!
  164. Goodbye! Goodbye!
  165. "A string!"
  166. ...is a SOL_STRING
  167. (buffer.sizeof.ptr = 8 )
  168. (buffer.sizeof.int = 4 )
  169. (buffer.sizeof.int*2 = 8 )
  170. (buffer.sizeof.int*2 + buffer.sizeof.ptr = 16 )
  171. ...string buffer: <Buffer @0x14743e0>
  172. ...with value: A string!
  173. --- IO redirection
  174. A line!
  175. An object: {["c"] = "turkey", ["b"] = 2, ["a"] = 1}
  176. Something mysterious :o
  177. Writing directly to a file :D...restored stdout.
  178. Buffered output was:
  179. ""
  180. ...second time.
  181. Hey there!
  182. lolololololololololololololololololololololololololololololololol
  183. ...restored.
  184. Output was:
  185. ""
  186. --- Substrings
  187. "This is a test!"
  188. "his is a test"
  189. "s is a te"
  190. "s "
  191. "s is a t"
  192. ""
  193. --- Splitting
  194. "This is a test!"
  195. ["This", "is", "a", "test!"]
  196. ["Th", "s ", "s a test!"]
  197. ["This is a test!"]
  198. ["Th", "s ", "s ", " t", "st!"]
  199. "This" "string"
  200. "is" "string"
  201. "a" "string"
  202. "test!" "string"
  203. --- Continue/break
  204. 0
  205. 1
  206. 2
  207. 3
  208. 4
  209. 5
  210. ---
  211. 1
  212. 3
  213. 5
  214. 7
  215. 9
  216. --- Control expressions
  217. 1 is true
  218. 0 is false
  219. [1000, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018]
  220. ( 0 )
  221. ( 1 )
  222. ( 2 )
  223. ( 3 )
  224. ( 4 )
  225. ( 5 )
  226. 5
  227. --- All done!