SHARE
TWEET

TMARL description

a guest Mar 8th, 2015 311 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. It is best to start with an example:
  2.  
  3.     $abc
  4.     $def
  5.     S4P
  6.  
  7. `$` denotes the start of a "template", what is used to match with the input. The template ends when the a line does not start with `$`. Thus the above template is:
  8.  
  9.     abc
  10.     def
  11.  
  12. `S` is the search keyword, searching the input with `4` as the argument. More on searches later.
  13.  
  14. `P` prints the result.
  15.  
  16. What one can do with templates
  17. ---
  18. You can mirror them with the `M` keyword:
  19.  
  20.     $abc
  21.     MP
  22.  
  23. Output: `$cba`
  24.  
  25. You can rotate them with the `R` keyword, where the argument is the number of rotations:
  26.  
  27.     $abc
  28.     R1P
  29.  
  30. Output:
  31.  
  32.     $a
  33.     $b
  34.     $c
  35.  
  36. You can append them to each other with `<`, `>`, `v`, and `^`. `v` and `^` are vertical, while `>` and `<` or horizontal. Remember, it points to the one that goes first!
  37.  
  38.     $world
  39.     >
  40.     $hello
  41.     P
  42.     -------------------
  43.     $helloworld
  44. and:
  45.  
  46.     $above
  47.     ^
  48.     $below
  49.     P
  50.     ----------------
  51.     $above
  52.     $below
  53.  
  54. You can multiply vertically with `*` or horizontally with `~`:
  55.  
  56.     $hello
  57.     *2P
  58.     --------------
  59.     $hello
  60.     $hello
  61.  
  62. horizontally:
  63.  
  64.     $hello
  65.     ~2P
  66.     ---------------
  67.     $hellohello
  68.  
  69. One can assign templates (and other stuff) to variables by following the template with an **unused** non keyword variable name. All lowercase letters (except `v`) should be available. Note: these are effectively immutable, and cannot be reassigned a different template/value.
  70.  
  71.     $abc
  72.     a
  73.     $def
  74.     b>a>bP
  75.     -------------
  76.     $defabcdef
  77.  
  78. You can search with them using the `S` keyword. This is probably the most important function in the whole language.
  79.  
  80. If the argument following is < 4, then it searches until it finds a match and returns the match.
  81.  
  82. If the argument is divisible by 2, then it searches regardless of rotation.
  83.  
  84. The `S` command returns either an array of matches, or a single match.
  85.  
  86. Arrays or anything with indexes
  87. ---
  88. Elements can be accessed with the `G` command, followed by the element index.
  89.  
  90. The length of an array can be acquired with the 'L' keyword.
  91.  
  92. Searches can be linked together with the `&` keyword.
  93.  
  94. Numbers
  95. ---
  96. There are only integers (in the code at least), and if you haven't noticed already, you can't put multi-digit numbers in the code.
  97.  
  98. Instead you can use `(...)`, which works like regular parentheses.
  99.  
  100. You can use `+` (addition), `-` (subtraction), `*` (multiplication), `/` (division, non-integer), `%` (modulus), and `^` (exponentiation).
  101.  
  102. Input
  103. ---
  104. If you should want to get the input as an array of lines, you're in luck! It is already in variable `I`.
  105.  
  106. Reserved letters in templates
  107. ---
  108.  
  109. `D` is any digit [0-9]
  110.  
  111. `*` is anything. Literally. It doesn't even have to exist. Think of it like a hole in the template.
  112.  
  113. `L` is any letter [a-zA-Z]
  114.  
  115. `l` is any lowercase letter [a-z]
  116.  
  117. `U` is any uppercase letter [A-Z]
  118.  
  119. `%` is the edge of a template, so `$%abc` would only match if `a` is on the left side of the input
  120.  
  121. You can escape these with a backslash `\`
  122.  
  123. There are (limited) character classes!
  124.  
  125. [abcd] is a or b or c or d.
  126.  
  127. [^abcd] is not a and not b and not c and not d.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top