NovaYoshi

native array and set thing

Jun 26th, 2018
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. nop :
  2. discard A :
  3. dup A : A A
  4. over A B : A B A
  5. swap A B : B A
  6. rot A B C : B C A
  7. push_null : null
  8. push_true : 1
  9. push_false : 0
  10. get_local A : locals[A]
  11. set_local A B : locals[B] = A
  12. get_global A : globals[A]
  13. set_global A B : globals[B] = A
  14. push_arg A : function arguments[A]
  15. string_constant A : strings[A]
  16. push_array : []
  17. push_set : set()
  18. add A B : A + B (also adds to sets or arrays)
  19. sub A B : A - B (also removes from sets or arrays)
  20. mul A B : A * B
  21. div A B : A / B
  22. mod A B : A % B
  23. big_shift A B : A << B if positive, A >> B if negative
  24. bit_and A B : A & B
  25. bit_or A B : A | B
  26. bit_xor A B : A ^ B
  27. get_index A B : A[B]
  28. set_index A B C : B[C] = A
  29. length A : len(A) (string length, set size, array length)
  30. ternary A B C : A?B:C
  31. not A : !A
  32. negate A : -A
  33. cmp_eq A B : A == B
  34. cmp_ne A B : A != B
  35. cmp_lt A B : A < B (or "A doesn't contain B")
  36. cmp_le A B : A <= B
  37. cmp_gt A B : A > B
  38. cmp_ge A B : A >= B (or "A contains B")
  39. call A : call functions[A]
  40. return : return from call
  41. jump A : goto labels[A]
  42. if_true A B : goto labels[B] if B != 0
  43. if_false A B : goto labels[B] if B == 0
  44. builtin A : escape code for more primitives
  45.  
  46. list of builtins:
  47. clone A : A (new copy)
  48. to_num A : num(A)
  49. to_str A : str(A)
  50. array_pop A : A[-1], and last member is removed
  51. slice A B C : A[B:C]
  52. del_index A B : delete A[B]
  53.  
  54. ---Data types---
  55. number
  56. string
  57. array
  58. set
  59.  
  60. ---Encoding---
  61. Two most significant bits control how big of a signed
  62. integer constant to push before the instruction runs.
  63. Bottom 6 bits control which function to run.
  64. 00ffffff
  65. 01ffffff xxxxxxxx
  66. 10ffffff xxxxxxxx yyyyyyyy
  67. 11ffffff xxxxxxxx yyyyyyyy zzzzzzzz wwwwwwww
Advertisement
Add Comment
Please, Sign In to add comment