a terrible forth-like language for making memes https://szy.io/memeforth
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.

DICTIONARY.md 7.2KB

8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
9 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. # FORTH words implemented in Memeforth.
  2. Examples show the Memeforth code and the resulting stack.
  3. ## Comparison/Logic Operators
  4. All of these push either `true` or `false` onto the stack as their result.
  5. * `==` Equals
  6. * `!=` Not-equals
  7. * `>` Greater than
  8. * `<` Less than
  9. * `>=` Greater than or equal
  10. * `<=` Less than or equal
  11. * `TRUE` Literal `true`
  12. * `FALSE` Literal `false`
  13. * `NOT` Boolean NOT
  14. * `AND` Boolean AND
  15. * `OR` Boolean OR
  16. ## Flow Control
  17. * `DO` Performs looping based on a start and end value.
  18. Example: `10 0 DO I . LOOP` outputs `0 1 2 3 4 5 6 7 8 9`
  19. * `I` Used to access the current loop index value.
  20. * `IF` Performs based on the top value on the stack.
  21. Example: `IF YEET ELSE NOYEET THEN` will result in "YEET" being on the stack if the top stack value is `true` before the `IF`, and `NOYEET` otherwise.
  22. * `:` Defines a new word.
  23. Example: `: DNSYEET yeet DNS ;` compiles to a word `DNSYEET` that becomes `DNS over yeet` on the stack.
  24. ## I/O Operations
  25. NOTE: See JS docs for how output is handled and how to access it. It is *not* printed to the console!
  26. * `TYPE`
  27. Print the top item of the stack to `output`. Discards the top stack element.
  28. * `.`
  29. Synonym for TYPE.
  30. * `.s`
  31. Print the contents of the stack to `output`. Does not affect the stack.
  32. ## Literals
  33. * Integers are automatically pushed onto the stack.
  34. * `s"`
  35. Starts defining a literal string and pushes it to the stack.
  36. Example: `s" my string here"` ⇒ `"my string here"`
  37. Note: The space after `s"` is necessary. Extra spaces will become leading spaces on the defined string.
  38. * `BLANK`
  39. Push an empty string to the stack.
  40. * `SPACE`
  41. Push a single space character to the stack.
  42. * `\n`
  43. Push a single newline character to the stack.
  44. * `(` Starts a comment until a closing `)`
  45. Not sure why this is in literals, but there's nowhere else that it really fits, so who cares.
  46. ## Math Operators
  47. * `+`
  48. Add the top two elements of the stack.
  49. * `+!`
  50. Add directly to a memory variable. For instance, if the variable `X` is `5`:
  51. `3 X +!` will result in `X` becoming `8` in memory.
  52. Example: `1 2 +` ⇒ `3`
  53. * `-`
  54. Subtract the top two elements of the stack.
  55. Example: `2 1 -` ⇒ `1`
  56. * `*`
  57. Multiply the top two numbers on the stack.
  58. Example: `2 2 *` ⇒ `4`
  59. Alternatively, can be used to multiply strings. For instance:
  60. `test 3 *` ⇒ `testtesttest`
  61. * `/MOD`
  62. Perform division and modulus and place the results on the stack.
  63. Example: `10 3 /MOD` ⇒ `1 3`
  64. * `/`
  65. Divide the top two numbers on the stack, returning the integer quotient.
  66. Example: `7 2 /` ⇒ `3`
  67. * `MOD`
  68. Perform the modulus operation on the top two numbers on the stack.
  69. Example: `7 2 MOD` => 1
  70. * `RAND`
  71. Generate a random integer between a min and a max.
  72. Example: `1 10 RAND` => a random number between 1 and 10.
  73. ## M E M E S
  74. This is what you're really here for.
  75. * `AAS`
  76. Generates an "as a service" meme.
  77. Example: `Yeet AAS` ⇒ `"YaaS (Yeet as a Service)"`
  78. * `BIT`
  79. Generates an "as a bit" meme.
  80. Example: `s" yeeting" BIT` ⇒ `"yeeting, as a bit"`
  81. * `B_EMOJI`
  82. Pushes "🅱️" to the stack.
  83. * `BMOJI`
  84. Replaces the first letter of a string with 🅱️.
  85. * `CLAP_EMOJI`
  86. Pushes "👏" to the stack.
  87. * `CLAP`
  88. Converts a string into `clapping👏text👏like👏this👏`.
  89. * `COOLKIDS`
  90. `yeet COOLKIDS` ⇒ `"all the cool kids are getting into yeet"`
  91. * `DNS`
  92. Generates a "DNS over" meme.
  93. Example: `s" carrier pigeon" DNS` ⇒ `"DNS over carrier pigeon`
  94. * `DRAKE`
  95. Generate a Drake like/dislike meme with Mastodon :drake_like: and :drake_dislike: emotes.
  96. * `FUCKING`
  97. Pushes the text `fuckign` to the stack.
  98. * `GOTEM`
  99. Pushes the text `lmao gottem` to the stack.
  100. * `HACKER`
  101. Generates Mastodon Hacker Text emotes from a string.
  102. Example: `s" yeet" HACKER` ⇒ `":hacker_y: :hacker_e: :hacker_e: :hacker_t:"`
  103. * `HARDWORK`
  104. Generate a "Just another hard day's work" meme.
  105. Example: `s" meme" HARDWORK` ⇒ `"Just another hard day's work at the 'meme' factory."`
  106. * `JORTS`
  107. Generates a "jorts" meme.
  108. Example: `s" yeet" JORTS` ⇒ `"jeet (jean yeet)"`
  109. * `MORELIKELY`
  110. Generate a "It's more likely than you think" meme.
  111. Example: `s" Memes" s" FORTH" MORELIKELY` ⇒ `"Memes? In my FORTH? It's more likely than you think"`
  112. * `OKGOOG`
  113. Generates an "OK Google" meme.
  114. Example: `s" run Memeforth" OKGOOG` ⇒ `"OK Google, run Memeforth"`
  115. * `OWNING`
  116. Generates an "owning the..." meme.
  117. Example: `boomers weed smartphones OWNING` ⇒ `"owning the boomers with weed and smartphones"`
  118. * `SUREHOPE`
  119. Generate a "Sure hope it does" meme.
  120. Example: `s" Markdown` ⇒ `"Markdown? I sure hope it does!"`
  121. * `SM64`
  122. Generates Mastodon SM64 Text emotes from a string.
  123. Example: `s" yeet" SM64` ⇒ `":sm64_y: :sm64_e: :sm64_e: :sm64_t:"`
  124. * `XORTS`
  125. Generates an arbitrary "jorts" meme with root and subject.
  126. Example: `s" blob" s" cat" XORTS` ⇒ `"bat (blob cat)"`
  127. ## Memory Operations
  128. Keywords that operate on the program's memory array.
  129. * `!`
  130. Stores a stack element into memory.
  131. Example: `s" mystring" 42 !` ⇒ Stores `"mystring"` at address 42 in memory.
  132. * `@`
  133. Fetches a memory location and puts it on the stack.
  134. Example: `42 @` given that memory location 42 = `"test"` will result in `"test"`
  135. being on the stack.
  136. * `DEFVAR`
  137. Defines variables.
  138. Example: `DEFVAR MYVAR` creates a variable called `MYVAR` that is a word that resolves to the memory location where `MYVAR` is stored.
  139. * `DEFARR`
  140. Defines arrays.
  141. Example: `DEFARR MYARR 10` creates a variable called `MYARR` that resolves to a pointer to the start of the array, which is of length 10.
  142. ## Stack Manipulation
  143. * `DUP`
  144. Duplicates the top element of the stack.
  145. Example: `1 DUP` ⇒ `1 1`
  146. * `2DUP`
  147. Duplicates the top pair of elements on the stack.
  148. Example: `1 2 2DUP` ⇒ `1 2 1 2`
  149. * `DROP`
  150. Drops the top element from the stack.
  151. Example: `1 2 DROP` ⇒ `1`
  152. * `2DROP`
  153. Drops the top two elements from the stack.
  154. Example: `1 2 3 2DROP` ⇒ `1`
  155. * `OVER`
  156. Copies the second element over the first.
  157. Example: `1 2 OVER` ⇒ `1 2 1`
  158. * `SWAP`
  159. Swaps the top two elements of the stack.
  160. Example: `1 2 SWAP` ⇒ `2 1`
  161. * `ROT`
  162. Rotates the stack.
  163. Example: `1 2 3 ROT` ⇒ `2 3 1`
  164. * `-ROT`
  165. Rotates the stack the other way.
  166. Example: `1 2 3 -ROT` ⇒ `3 1 2`
  167. ## String operations
  168. * `CONCAT`
  169. Concatenates the top two strings on the stack.
  170. Example: `s" string1" s" string2" CONCAT` ⇒ `"string1string2"`
  171. * `LEN`
  172. Replaces the top string on the stack with its length.
  173. Example: `s" stringy" LEN` ⇒ `7`
  174. * `SLICE`
  175. Slices a string.
  176. Example: `yeet 1 3 SLICE` => `ee`.
  177. * `SPLIT`
  178. Splits a string into individual stack elements based on a delimiter. It also pushes the number of split elements to the stack for later rejoining.
  179. Example: `s" split-me-up" s" -" SPLIT` => `split me up 4` (Each a separate word on the stack).
  180. * `JOIN`
  181. Joins multiple stack elements into a single string.
  182. Example: `join me up 3 s" " JOIN` => `"join me up"` (As a single string on the stack)
  183. * `ISUPPER` Test if the top string on the stack is entirely uppercase.
  184. * `ISLOWER` Test if the top string on the stack is entirely lowercase.
  185. * `TOUPPER` Convert the top string on the stack to uppercase.
  186. * `TOLOWER` Convert the top string on the stack to lowercase.