Advertisement
12Me21

aaa

Sep 10th, 2016
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.03 KB | None | 0 0
  1. number (sequence of digits 0-9, ~ prefix for negatives)
  2. " toggle string mode:
  3. on: push 0,
  4. off: push string in reverse order
  5.  
  6.  
  7. + add
  8. - subtract
  9. * multiply
  10. / integer division
  11. % mod
  12. : duplicate top of stack
  13. \ swap top 2
  14. ! logical not
  15. @ push line number
  16. & go to line
  17. A-F write to variable
  18. a-f read
  19. 'skip the rest of the line (comment)
  20. # sleep
  21. ? print number
  22. $ pop and print CHR$ until it reaches 0
  23. _ skip if 0 (originally was if NOT 0, but I never ended up using this)
  24. | go down number of lines
  25. ^ go up number of lines (obsolete and dumb, but I just can't remove it. it was literally the first command I thought of)
  26.  
  27.  
  28. unused symbols:
  29. G-Z,g-z (may be used for more variables or accessing other stuff) (should not be assigned randomly (yet(?)), like p and g in befunge)
  30. ` (no one likes this symbol :P)
  31. ()[]{} may be used for some kind of loop or something. but that seems like too much structure for me, so...
  32. = might be used to check if 2 vars are equal, but you could always do -! so that seems wasteful...
  33. < > again, could be used for greater than or less than, this is more likely but I might consider using them to jump within a line (though I want this language to be heavily line-oriented so I really shouldn't add that)
  34. ,. ugh these are so small and uncentered. additionally, if I wanted to allow real numbers, I would want . to be available. and , idk who cares
  35. ; I'm using this for debug, that might be what is stays at. however, I might consider using it to duplicate the 2nd value, either like:
  36. 1,2,3 -> 1,2,2,3 or 1,2,3 -> 1,2,3,2 this seems oddly specific but I feel like it's something that I've wanted.
  37. --now I must get this out of the way... IDK if this langugage is turing complete, I suspect maybe not. and I'm sure someone would LOVE to RUIN the language, like what happened with befunge-98
  38. so please, suggest things to me, don't try to make it on your own--
  39.  
  40. whitespace:
  41. new lines are important and must be preserved. as well as CONSECUTIVE new lines
  42. OH! I'll use , as a new line substitute, so that if you are posting programs on a terrible site that doesn't allow new lines, then you can use commas.
  43. spaces are also important.
  44. consider this:
  45. 10 6
  46. this pushes 10 and 6, but if spaces are removed, it's suddenly 106. (BAD)
  47. tabs should be treated the same way (I discourage their use because of inconsistant support, however)
  48.  
  49.  
  50.  
  51.  
  52.  
  53. so the new commands I am considering are:
  54. ; pop a, pop b, push b, push b, push a
  55. , same use as a new line (note: reccommended to be converted when saving/loading, or before execution, as the interpreter is line based)
  56. . reserved (for decimal point)
  57. ` end program (reasoning: this symbol is disgusting)
  58.  
  59. ok so here's a program to get the fibonnaci sequence:
  60. 1
  61. @A
  62.  
  63.  
  64.  
  65. a&
  66.  
  67.  
  68.  
  69.  
  70. Uses a stack that starts out with infinite 0s (this can of course be emulated by making POP return 0 when stack is "empty")
  71.  
  72.  
  73.  
  74.  
  75. LITERALS:
  76. " toggle string mode:
  77. on start: push 0
  78. during: push each character onto a temporary string variable
  79. on end: push ascii values of all characters on string, from end to start.
  80. sequence of digits, ~ prefix for negatives: Push the number to the stack
  81. ' comment: (skip rest of current line)
  82. OUTPUT:
  83. $ string output: pop, print character, repeat until popped value is 0.
  84. ? number output: pop value and print.
  85. INPUT:
  86. # sleep: wait until button/key is pressed
  87. CALCULATION:
  88. + add: pop two values, push the sum
  89. - subtract: pop a,b push b-a
  90. * multiply: pop two values, push the product
  91. / integer division: pop a,b push b/a, rounded towards 0 (integer division (DIV in some languages))
  92. % mod: pop a,b push b mod a.
  93. ! logical not: pop a value, and push 1 if the value is 0, and 0 otherwise
  94.  
  95. STACK:
  96. : duplicate top value
  97. ; duplicate 2nd value (equivilant to ABbba)
  98. \ swap top two values
  99. MOVEMENT:
  100. @ push line number
  101. & pop number, jump to that line. if negative, add the program length (so you can jump to -1 to end the program)
  102. ^ pop number, go up that many lines. if 0, restart current line
  103. _ pop number, if 0 then skip next line
  104. | pop number, jump down that many lines
  105. VARIABLES:
  106. A-F store value
  107. a-f read value
  108. RESERVED:
  109. , substitiute for line break
  110. . reserved for possible real numbers
  111. UNUSED:
  112. =
  113. `
  114. ()
  115. {}
  116. []
  117. <> possibly
  118.  
  119.  
  120.  
  121. ( = skip unless line was jumped to by ^ _ or |
  122. ) = ayy lmao
  123. {} = just loop forever goddammit
  124. [] = stop adding so many fucking brackets, ok?
  125. <> = lol input XD
  126.  
  127.  
  128. but really, how about macros?
  129.  
  130. G-Z or something, will be definable
  131.  
  132. so like
  133.  
  134. G'rest of line is now the macro
  135.  
  136. and called using g
  137.  
  138. ugh but then we still has no uses for the braaaaaaackets
  139.  
  140. ok ok really now
  141.  
  142.  
  143. () will be some controlled line skip thing, to make switch case thingys easier, for example.
  144. {} will be loop forever, and then you can use _ to break out of it if you want.
  145. [] will be a block comment, anything inside is ignored.
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154. { = push LINE number (yes you heard me) to stack 2,
  155. } = pop from stack 2 and goto that line
  156. ( = skip unless line was jumped to
  157. ) = ???
  158. G-Z = define rest of line as a macro (implications PLZ)
  159. g-z = execute macro. spacing and new lines are preserved. so keep that in mind. (of course macros can't have nls since they are by definition a single line)
  160. ) = execute once (applies to entire line. should be used at the start. the line WILL still take up space in the program. perhaps you can simply just set the variable holding that line's code to "".
  161. ` = greater than (maybe)
  162. = = get inkey$. perhaps for useage after a #? yeah I wanted this one to be the ONLY way to input because it's the only thing left xd
  163. input value (sorry I'm really running out of symbols to use). if it's a number (regex: -?\d+) then push number, else push like a string lmao
  164. [ = ignore code until next ]
  165. ] = end BLOCK comment (not normal comment though)
  166. OH I KNOW!!!
  167. change:
  168. < > = greater / less (wow wasteful IK)
  169. = is input number
  170. ` is input string
  171. problems is solve.
  172. WwwwWWwwWWwwrrr
  173.  
  174. a few notes: division and mod by 0 will return 0, since crashes are baad.
  175. using } when nothing is on the stack results in no movement.
  176. ] when not in a block comment does nothing
  177. ` should use the normal string input, where you type in characters and press enter to submit
  178. = is the same, but must only allow numbers.
  179. program execution only stops when reaching the end of the program.
  180. you can do this using ~1& which jumps to the last line (always empty)
  181.  
  182. if you have any questions please ask me, I might have forgotten to explain something.
  183. variables are all signed integers, something like 32 bit is the normal, but not required.
  184.  
  185. variables are signed 32 bit integers
  186. when popping an empty stack, return 0
  187. division and mod by 0 will return 0
  188.  
  189.  
  190. { push line number to stack 2
  191. } pop line number from stack 2 and go to that line
  192.  
  193. To be used at the beginning of lines only
  194. ( rest of skip line, unless the line was jumped to by ^ _ | or &
  195. ) delete line after execution
  196. G-Z rest of line is saved to that variable (macros)
  197.  
  198. g-z execute corresponding macro (as if the letter was replaced by the code)
  199. [ skip code until you reach the next ]
  200.  
  201. instructions sorted by ascii code:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement