PixelatedStarfish

Mbv121

Feb 1st, 2022
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.01 KB | None | 0 0
  1.  
  2. =MacroBeep Documentation v 1.2.1=
  3.  
  4. Thank you for using MacroBeep! A language by @PixelatedStarfish on esolangs.org (Andrew Vella)
  5. This documentation provides a reference for use, and fully defines an interpreter for the language.
  6.  
  7. File Extension .mcbe
  8.  
  9. Comments and and Questions can be left on this page:
  10. https://esolangs.org/wiki/Talk:MacroBeep
  11.  
  12.  
  13. ==Contents==
  14.  
  15. Acknowledgements
  16. Introduction to MacroBeep
  17. Language Paradigm and Memory
  18. Instruction Set
  19. The Preprocessor and Include Statements
  20. Program Examples
  21. Error Codes
  22. Turing Machines and the MacroBeep Tape
  23. Proof of Turing Completeness
  24. Grammar in EBNF
  25. Interpreter Test Cases in Java
  26. ASCII Table Reference
  27. Change Log
  28. Sources
  29.  
  30.  
  31. ==Acknowledgements==
  32.  
  33. I certainly would like to thank family, friends, and of course, mademoiselle for their support and care.
  34. Thank you to the Skidmore College faculty, O'Connell, Dufour, Eckmann, Read, Reiley, and Prasad. I am
  35. so glad to have my degree in computer science!
  36. I would also like to thank Bringas, Kravsky, and Lee for their tutelage, patience, and inspiration.
  37. MacroBeep would not exist without the esolangs wiki and the work of youtuber Truttle1.
  38.  
  39.  
  40. ==Introduction to MacroBeep==
  41.  
  42. Macrobeep is designed in response to common problems people face when learning to code in more conventional
  43. programming languages. The syntax is designed to communicate what the computer is doing in a clear and
  44. concise manner. For every MacroBeep program, there is an equivalent MacroBeep program that can described
  45. as a sequence of native instructions in a specific order.
  46.  
  47. A MacroBeep programmer does not have to search for the missing punctuation. They do not need to find
  48. the unmatched parenthesis, or count their braces. They do not need to deal with the particularities of
  49. data types or the difference between objects, classes, structs, and interfaces.
  50.  
  51. This language is not without cons. A programmer needs to manage program memory themselves. Data cannot
  52. be protected. It is up to the programmer to make sure that something is not overwritten before it should
  53. be. A MacroBeep programmer should also be familiar with Turing machines and the ASCII table.
  54. This document covers everything you need to program in MacroBeep.
  55.  
  56.  
  57. ==Language Paradigm and Memory==
  58.  
  59. MacroBeep is an assembly style language with an instruction set, such that the programmer can define
  60. macros in order to describe and implement more complex operations.
  61. MacroBeep is not a language in the functional language paradigm. There is no part of a MacroBeep program
  62. that can be considered stateless, and there are no functions in MacroBeep. Instead, a program modifies
  63. bytes on a tape using a pointer in a manner similar to bf, such that each cell on the tape can store
  64. a value between 0 and 255 inclusive.
  65. A program in MacroBeep will always run the main macro before any other macro. This language has a call
  66. stack, and the main macro is the first item on that call stack.
  67.  
  68.  
  69. ==Instruction Set==
  70.  
  71. Each operation can take an identifier or an integer value as an argument.
  72. A macro cannot be a reserved word or operation name.
  73. Operations are separated by a newline, and arguments by a space.
  74.  
  75. Before reading the table, a quick clarification should be made.
  76. A branching instruction does either of these:
  77.  
  78. - shifts execution forward by some (positive or negative) number of instructions
  79. - starts execution at the label given
  80.  
  81. ===Instruction Table===
  82.  
  83. macro (define macro; takes an identifier)
  84.  
  85. do (do macro identified in arg, call macro)
  86.  
  87. rt (return to macro call an execute next instruction)
  88.  
  89. null (set cell to 0)
  90.  
  91. str (store value of current cell in next cell; store value of cell in right adjacent cell)
  92.  
  93. rand (set cell a random from 0 to arg or 0 to 255)
  94.  
  95. add (add to cell; 1 if no arg)
  96.  
  97. sub (take from cell; 1 if no arg)
  98.  
  99. right (move pointer to the right; by 1 if no arg is given)
  100.  
  101. left (move pointer to the left; by 1 if no arg is given)
  102.  
  103. head (go to head of tape)
  104.  
  105. pos (get position of cell pointer on tape and print it)
  106.  
  107. inp (get input; char int or string)
  108.  
  109. out (print cell or arg)
  110.  
  111. cout (print char on cell or arg as char)
  112.  
  113. pr (print any value given as a string with a newline, newline if nothing. Use '[]' to print a space
  114. and '{}' to print a tab)
  115.  
  116. beep (it goes beep, use an argument to specify frequency in hertz. Default is 1000)
  117.  
  118. label (for an example of how to use a a label, see the false machine)
  119.  
  120. solar (branch if cell is greater than 0)
  121.  
  122. lunar (branch if cell is 0)
  123.  
  124. venusian (branch if cell is equal to next cell)
  125.  
  126. martian (branch if cell is not equal to next cell)
  127.  
  128. jovian (branch if cell is greater than next cell)
  129.  
  130. plutonic (branch if cell is less than next cell)
  131.  
  132. vestian (branch if cell is greater than or equal to next cell)
  133.  
  134. sednian (branch if cell is less than or equal to to next cell)
  135.  
  136. halt (end program)
  137.  
  138. wait (adds a delay of 100ms, or as specified by an argument)
  139.  
  140. include (include files at path identified)
  141.  
  142. # (comment)
  143.  
  144.  
  145. ==The Preprocessor and Include Statements==
  146.  
  147. The Preprocessor formats source code so that it can run appropriately. All leading whitespace before
  148. an instruction is removed. All blank lines are removed. If needed, all null lines are replaced with empty
  149. comments. (Comments are ignored at runtime and do not need to be removed.) Additionally, all include
  150. statements are processed. The contents of each included file are concatinated into a single set of source.
  151.  
  152. The include statement includes all the macros in a file so a program can use them.
  153. As stated above, include statments include files at the path identified. So...
  154.  
  155. include run\foo\hw.mcbe
  156.  
  157. ... includes the hw.mcbe file in a subdirectory foo, in run. Note that the run directory (or folder) is
  158. included in the file path. This ensures that the interpreter will look for files in the run directory.
  159.  
  160. The entire contents of a directory can be included using an asterisk ( * ) like so...
  161.  
  162. include run\foo\*
  163.  
  164. Now suppose that hw.mcbe also has include statements. A programmer could write paths back to run
  165. but it can be tedious if the path back to the run directory is long. The closing angle bracket
  166. ( > ) is useful for this case. It gets replaced with the path from run to hw.mcbe. So...
  167.  
  168. include run\foo\bar\tm.mcbe
  169.  
  170. is equivalent to
  171.  
  172. include >\bar\tm.mcbe
  173.  
  174.  
  175. ===Pedantic Note: Include Instruction or Include Statement?===
  176.  
  177. So you might have read the last paragrah and noticed 'include statement' not 'include instruction'.
  178. While 'include' is listed as an instruction in the instruction set, it is not technically correct to
  179. call them include instructions. Include statements are processed by the preprocessor but not executed.
  180. This is because they are not executable instructions, but placeholders. Comments are also listed in the
  181. instruction set, even though they are also not technically executable instructions. This is so a programmer
  182. can read the set and understand everything that the language can do. It is not particularily wise to
  183. have some edge case somewhere else. This would not be an effective reference document if a programmer
  184. could not find information about how to write comments or include files in their programs. Knick-knacks
  185. are not books, but they sit on the bookshelf anyway, where they can be seen and appreciated. The bookshelf
  186. does not mind, and the books like the company.
  187.  
  188. In summary, include statements are not instructions, but they are statements.
  189. Like comments, include statments are in the instruction set just to keep things tidy and readable.
  190.  
  191.  
  192. ==Program Examples==
  193.  
  194. It is good practice to indicate the scope of an instruction with tabs or spaces. This can be useful to
  195. indicate which instructions are part of a macro. Leading white space is not required. New lines are the
  196. only significant white space characters.
  197.  
  198. ===Hello World===
  199. macro main
  200. pr Hello[]World
  201. # Note that the [] is printed as a space
  202.  
  203. ===Truth Machine===
  204. macro main
  205. pr Type[]a[]0[]or[]1[]into[]the[]truth[]machine.
  206. inp 1
  207. solar 3
  208. pr 0
  209. halt
  210. pr 1
  211. wait
  212. solar -3
  213.  
  214. ===False Machine===
  215. macro main
  216. pr Type[]a[]0[]or[]1[]into[]the[]false[]machine.
  217. inp 1
  218. lunar magic
  219. pr 1
  220. halt
  221. label magic
  222. pr 0
  223. wait
  224. lunar magic
  225.  
  226. ===Cat===
  227. macro main
  228. pr Give[]me[]a[]word[]and[]I[]will[]say[]it[]back!
  229. inp 2
  230. head
  231. cout
  232. right
  233. solar -3
  234.  
  235. ===C scale===
  236. macro main
  237. beep 262
  238. beep 294
  239. beep 330
  240. beep 349
  241. beep 392
  242. beep 440
  243. beep 494
  244. beep 523
  245.  
  246. Note that the main macros do not include a return statement 'rt'. This is becuase the program ends when
  247. the macro does. A 'rt' can be added to the main macro but it is not required. A macro without an 'rt'
  248. will continue to execute until it reaches an 'rt' somewhere or gets to an End Of File. So...
  249.  
  250. macro main
  251. beep
  252. macro sub
  253. beep 555
  254. rt
  255.  
  256. ...will execute. 'do sub' will execute the macro 'sub'. 'do main' will execute from the top to the 'rt'.
  257. However, any statements after the 'rt' would not execute, since macro 'main' has finished.
  258.  
  259.  
  260. ==Error Codes==
  261.  
  262. Error (0)
  263. The Generic Error Message, for errors not described below.
  264.  
  265. Undefined Instruction (1)
  266. Thrown when the interpreter encounters an instruction that is not defined in the instruction set.
  267.  
  268. File Not Found (2)
  269. Either the file does not exist, or it is in the wrong directory.
  270.  
  271. Undefined Macro or Label (3)
  272. The macro called by "do" has no matching definition; alternatively, the label branched to does not exist.
  273.  
  274. Missing Main Macro (4)
  275. "macro main" is missing, the program cannot start.
  276.  
  277. Stack Overflow (5)
  278. This error is most commonly caused by an infinite recursion. Too many macro calls on the call stack.
  279.  
  280. Not a Cell Error (6)
  281. Occurs when a program tries to modify a cell that does not exist, such as cell -1 or cell infinity.
  282.  
  283. Include Statement in Macro (7)
  284. An include statement cannot be written into a macro definition.
  285.  
  286. Preproccesor Error (8)
  287. A preproccesor error that is not caught by any other error code. Check include statements carefully.
  288.  
  289. Duplicate Macro or Label (9)
  290. A macro or label is defined more than once in the program. Calls to it are ambiguous.
  291.  
  292. Argument Error. Integer Expected (10)
  293. An instruction that only takes an integer argument was not given an integer argument.
  294.  
  295. Bad Argument (11)
  296. This is the error thrown when the interpreter reads statements that are syntactically correct, but incomputable
  297. in this language, such as "wait -100". Esoteric models of time notwithstanding, instructions that require
  298. negative time to compute would throw this error.
  299.  
  300. Astrological Error (12)
  301. This error occurs when the next instruction to execute is located outside source entirely. It can only
  302. be thrown by the "solar" and "lunar" operators, which allow the instruction pointer to jump around (an
  303. ability critical for logical operators and conditional statements, or branching). It is as if you gave
  304. the interpreter a To-Do list of 10 or so items in an order, and then said "Hey, no need to do that fifth
  305. thing, go do item 24, or -5 instead." Confusion would be understandable, and nothing would get done!
  306.  
  307.  
  308. ==Turing Machines and the MacroBeep Tape==
  309.  
  310. ===What is a Turing Machine?===
  311.  
  312. The Turing Machine is a theoretical machine first described by Alan Turing. It consists of a tape divided
  313. into cells and a pointer that can modify cells on the tape. The tape extends without bound, so the machine
  314. never runs out of cells. (In practice, this is not possible, but such a limitation is usually ignored).
  315. A Turing machine can do the following:
  316.  
  317. Shift the pointer left or right
  318. Read the value on the cell
  319. Write a value to a cell
  320.  
  321. The pointer can point to one cell at any given time, and it can only act on the cell at which it points.
  322. To act on another cell the pointer has to move to that cell. The pointer of a Turing Machine is programmable.
  323. It can be given instructions like: "Set the current cell to 0", or "If the current cell is one, go one
  324. cell to the right". These instructions describe something called a Finite State Machine, which a machine
  325. that knows its current state, and decides what to do next according to its instructions.
  326. In the case of "If the current cell is one, go one cell to the right", the pointer can read the current
  327. cell, and decide whether or not it should go to next cell on the right. If the current cell is one, the
  328. pointer goes right (which changes its state), and if not, it stays put.
  329.  
  330. The typical Turing machine has cells that can be set to 0 or 1 (sometimes 'blank' or 'null' is included,
  331. meaning no data is on this cell). Here is a crude, plain text visual, with the pointer pointing to the
  332. second cell on the tape:
  333.  
  334.  
  335. 1 | 1 | 0 | 1 | 0 | 0 | 1
  336. ^
  337.  
  338. The first cell of the tape is called the head of the tape, all other cells are positioned right of the
  339. head.
  340.  
  341. The Turing Machine can compute anything that is computable, and anything that can simulate a Turing Machine
  342. can compute anything that is computable. To put it another way, such a machine can decide any decidable
  343. problem, or solve any solvable math problem if it is programmed to do so. Something that can simulate
  344. a Turing Machine is Turing Complete, and any Turing Complete system can simulate any other Turing Complete
  345. system.
  346.  
  347. ===The MacroBeep Tape===
  348.  
  349. MacroBeep makes use of a Turing Machine for computation, but cells on this machine can store any integer
  350. value from 0 to 255 inclusive. In other words, each cell stores a byte of information, equivalent to
  351. 8 cells in the tape above. Many esoteric programming languages use a tape like this one. The most notable
  352. example is none other than one of the earliest, a language by Urban M?¼ller with a swear word in the
  353. name,
  354. which will be referred to as bf. Here is a visual of the byte tape used in bf and MacroBeep:
  355.  
  356. 000 | 255 | 023 | 150 | 045 | 213 | 010
  357. ^
  358.  
  359. Note that, as with a Turing machine, the tape extends to the right without bound. Also note that the
  360. pointer can do all of the things a pointer on a Turing machine can. Furthermore this pointer can modify
  361. bytes, adding or subtracting from them such that they can be at any integer value from 0 to 255.
  362. The initial state of the tape is such that every cell is set to 0.
  363.  
  364. In MacroBeep, 'pos' gives the pointer postion, 'out' gives the current cell value; 'left' and 'right'
  365. move the pointer, 'add' and 'sub' modify cell values. Note that 'pos' and 'out' are excellent debugging
  366. operations. See the Instruction Set for more information.
  367.  
  368.  
  369. ==Proof of Turing Completeness==
  370.  
  371. bf is Turing complete, and consists of only eight instructions.
  372. Given the above, by translating each bf command to MacroBeep, it can be shown that MacroBeep is also
  373. Turing complete.
  374. This table provides a means to translate between MacroBeep and bf.
  375.  
  376. MacroBeep bf Description
  377.  
  378. right > increment
  379.  
  380. left < decrement
  381.  
  382. add + add 1 to cell
  383.  
  384. sub - take 1 from cell
  385.  
  386. cout . Output ASCII value at cell
  387.  
  388. inp , Take input at cell
  389.  
  390. lunar (by some positive number of instructions) [ jump past ' ] ' if cell is 0
  391.  
  392. solar (by some negative number of instructions) ] goto ' [ ' if cell is greater than 0
  393.  
  394.  
  395. ==Grammar in EBNF==
  396.  
  397. Extended Backus-Naur Form is a metasyntax that can describe the syntax of a programming language.
  398. It is useful for understanding how the language is parsed for interpretation.
  399.  
  400. Key:
  401. ::= assignment, equivalence
  402. | or
  403. (group)
  404. {repeated at least one time}
  405. [optional]
  406. 'string literal'
  407. symbol
  408. , symbol concatination
  409. ; symbol terminator
  410. (*comment*)
  411.  
  412. Program ::= {statement}
  413. statement ::= macro | instruct
  414. macro ::= 'macro', s, alnum, n, {instruct}, ['rt']; (*be careful when leaving out 'rt'*)
  415. instruct ::= word, s, [arg], n;
  416. arg ::= alnum | inte
  417. alnum ::= {(lett | digit)};
  418. word ::= {lett};
  419. inte ::= {digit};
  420. s ::= ' ';
  421. n ::= '\n';
  422. digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
  423. lett ::= 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' |
  424. 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' |
  425. 'y' | 'z';
  426.  
  427.  
  428. ==Interpreter Test Cases in Java==
  429. import java.io.FileNotFoundException;
  430.  
  431. public class Tests {
  432.  
  433. //Note that each instruct needs to be tested with and without parameters (excluding tests that have code directly copied from other fully tested instructions)
  434.  
  435. public static void main(String args[]) {
  436. String test = FalseMachine;
  437.  
  438. System.out.println(test + "\n");
  439.  
  440. try {
  441. Main.Interpret(test);
  442. Main.end();
  443. } catch (FileNotFoundException e) {
  444. e.printStackTrace();
  445. } catch (InterruptedException e) {
  446. e.printStackTrace();
  447. }
  448. }
  449.  
  450. //Input and Output Tests
  451. //macro main is tested in every test in this category
  452.  
  453. //Tests pr, comment, space, newline, then tab //PASSED
  454. public static String HelloWorld = "macro main\n"
  455. + "pr Hello[]Worlds!\n # include SUDDENLY A COMMENT WOAH!!\n\npr\npr Hello{}World";
  456.  
  457. //Tests pr, solar, halt, wait, inp 1 //PASSED
  458. public static String TruthMachine = "macro main\n"
  459. + "pr Type[]a[]0[]or[]1[]into[]the[]truth[]machine.\n"
  460. + "inp 1\n"
  461. + "solar 3\n"
  462. + "pr 0\n"
  463. + "halt\n"
  464. + "pr 1\n"
  465. + "wait\n"
  466. + "solar -3";
  467.  
  468. public static String FalseMachine = "macro main\n"
  469. + " pr Type[]a[]0[]or[]1[]into[]the[]false[]machine.\n"
  470. + " inp 1\n"
  471. + " lunar magic\n"
  472. + " pr 1\n"
  473. + " halt\n"
  474. + " label magic\n"
  475. + " pr 0\n"
  476. + " wait\n"
  477. + " lunar magic\n";
  478.  
  479. //Tests inp 2, head, cout, right, solar //PASSED
  480. public static String Cat = "macro main\n"
  481. + "pr Give[]me[]a[]word[]and[]I[]will[]say[]it[]back!\ninp 2\nhead\n"
  482. + "cout\nright\nsolar -3";
  483.  
  484. //Tests beep //should beep at 1000, 3300 mod 2501, and 500 hertz //PASSED
  485. public static String Beep = "macro main\n beep\n beep 3300\n beep 500";
  486.  
  487. //Should print the integer value of the given ASCII char //PASSED
  488. public static String StdIO = "macro main\n inp \n out";
  489.  
  490. //Should print the integer value of the given ASCII char //PASSED
  491. public static String WhyIO = "macro main\n inp 7 \n out";
  492.  
  493.  
  494. public static String Outs = "macro main\nout\n out 75\n add 72\n cout\n sub 10\n cout 72\n";
  495.  
  496. //Should output 3 //PASSED
  497. public static String posTest = "macro main\n right 5\n left 2\n right\n left\n pos";
  498.  
  499. //Error Tests
  500.  
  501. //PASSED Should throw Err 1
  502. public static String BadInst = "macro main\n foo";
  503.  
  504. //PASSED Should throw Err 2
  505. public static String FNF = "include foo\n macro main";
  506.  
  507. //PASSED Err 2, get content of non-existant dir
  508. public static String PrepErr = "include this_directory_does_not_exist\\*";
  509.  
  510. //PASSED Should throw Err 3
  511. public static String UndefMacro = "macro main\n do foo";
  512.  
  513. //PASSED Should throw Err 3
  514. public static String UndefLabel = "macro main\n cosmic foo";
  515.  
  516. //PASSED Should throw Err 4
  517. public static String Null = "";
  518.  
  519. //PASSED. Throws 5. print stack length for this test, it throws an OutOfMemoryError
  520. public static String StackOverflow = "macro store\n do store\n \nmacro main\n do store";
  521.  
  522. //PASSED Should throw Err 6, tests left
  523. public static String NegCel = "macro main\nleft\nadd 50";
  524.  
  525. //PASSED Should throw Err 6, tests right
  526. public static String EndTape = "macro main\nright\nadd 2\n solar -3";
  527.  
  528. //PASSED Err 7 test
  529. public static String IncMac = "macro main\ninclude foo";
  530.  
  531. //PASSED Err 8 test
  532. public static String PrepErr2 = "include\n\nmacro main\n";
  533.  
  534. //PASSED Err 8, get content of empty dir
  535. public static String PrepErr3 = "include this_directory_is_empty\\*";
  536.  
  537. //PASSED Err 9 test
  538. public static String DupM = "macro main\n macro foo\n macro foo";
  539.  
  540. //PASSED Err 9 test
  541. public static String DupL = "macro main\n label foo\n label foo";
  542.  
  543. //PASSED no Err 9 test
  544. public static String noDup = "macro main\n macro foo\n label foo";
  545.  
  546. //PASSED Throws 10
  547. public static String NonIntArg = "macro main\n wait foo";
  548.  
  549. //PASSED, tests wait, throws 11
  550. public static String BadArg = "macro main\n wait -100";
  551.  
  552. //PASSED err12
  553. public static String e12 = "macro main\nlunar -10";
  554.  
  555. //Remaining Instruction Tests
  556.  
  557. //The Solar and Lunar tests should output 0, PASSED
  558. public static String Solar = "macro main\n add 1\n pos\nsolar";
  559. public static String Lunar = "macro main\n pos\nlunar";
  560.  
  561. //PASSED Expected Output:
  562. //23
  563. //0
  564. public static String twthze = "macro thing\n"
  565. + " add\n"
  566. + " add 25\n"
  567. + " sub\n"
  568. + " sub 2\n"
  569. + " rt\n"
  570. + "macro main\n"
  571. + " do thing\n"
  572. + " out\n"
  573. + " pr\n"
  574. + " null\n"
  575. + " out\n"
  576. + " rt";
  577.  
  578. //PASSED outputs HH
  579. public static String Store = "macro main\n add 72\n str\n right\n cout\n str 5\n right 5\n cout";
  580. //PASSED. Not a cell Error.
  581. public static String noStore = "macro main\n str -10";
  582.  
  583. //Note each rand test should be done a few times
  584. //PASSED outputs a random number from 0 - 255
  585. public static String Rand1 = "macro main\n rand\n out";
  586.  
  587. //PASSED rand from 0 - 10
  588. public static String Rand2 = "macro main\n rand 10\n out";
  589.  
  590. //PASSED output between 245 to 255
  591. public static String Rand3 = "macro main\n rand -10\n out";
  592.  
  593. //rather than writing several tests for branch instructs, swap each one out here
  594. public static String brTest = "#generic branch instruction test\n"
  595. + "macro main\n"
  596. + "\n"
  597. + "#set up\n"
  598. + "rand 10\n"
  599. + "right\n"
  600. + "rand 10\n"
  601. + "left\n"
  602. + "\n"
  603. + "#tested instruct goes after the label 'goBack' \nlabel goBack\n\n"
  604. + "sednian next\n"
  605. + "pr\n"
  606. + "wait\n"
  607. + "pr Looped[]at[] \n"
  608. + "out \n"
  609. + "right\n"
  610. + "pr [],[]\n"
  611. + "out\n"
  612. + "left\n"
  613. + "pr\n"
  614. + "rand 10\n"
  615. + "\n"
  616. + "cosmic goBack\nlabel next"
  617. + "\n\npr\n"
  618. + "pr Exited[]loop[]at[]values[]\n"
  619. + "out \n"
  620. + "right\n"
  621. + "pr [],[]\n"
  622. + "out\n"
  623. + "\n"
  624. + "pr\npr\n"
  625. + "pr End[]of[]test\n"
  626. + "\n"
  627. + "";
  628.  
  629.  
  630. //Include Tests
  631.  
  632. //There are six such tests, each test uses 3 files: MAIN, A, and B respectively.
  633. //Each test should produce the same output, a beep at 1000 and a beep at 500;
  634. //excluding the first test, which should only output a beep.
  635.  
  636. //Test 1
  637. //MAIN
  638.  
  639. //include a.mcbe
  640. //macro main
  641. //do b
  642.  
  643. //A
  644.  
  645. //macro b
  646. //beep
  647. //rt
  648.  
  649. //Test 2
  650. //MAIN
  651.  
  652. //include a.mcbe
  653. //include b.mcbe
  654. //macro main
  655. //do b
  656. //do c
  657.  
  658. //A
  659.  
  660. //macro b
  661. //beep
  662. //rt
  663.  
  664. //B
  665.  
  666. //macro c
  667. //beep 500
  668. //rt
  669.  
  670. //Test 3
  671. //MAIN
  672.  
  673. //include dir/a.mcbe
  674. //include dir/b.mcbe
  675. //macro main
  676. //do b
  677. //do c
  678.  
  679. //A
  680.  
  681. //macro b
  682. //beep
  683. //rt
  684.  
  685. //B
  686.  
  687. //macro c
  688. //beep 500
  689. //rt
  690.  
  691. //Test 4
  692. //MAIN
  693.  
  694. //include a.mcbe
  695. //macro main
  696. //do b
  697. //do c
  698.  
  699. //A
  700.  
  701. //include b.mcbe
  702. //macro b
  703. //beep
  704. //rt
  705.  
  706. //B
  707.  
  708. //macro c
  709. //beep 500
  710. //rt
  711.  
  712. //Test 5
  713. //MAIN
  714.  
  715. //include run\foo\*
  716.  
  717. //macro main
  718. //do that
  719. //do this
  720.  
  721.  
  722. //A (in run/foo)
  723.  
  724. //macro that
  725. //beep
  726. //rt
  727.  
  728. //B (in run/foo/bar)
  729.  
  730. //macro this
  731. //beep 500
  732. //rt
  733.  
  734. //Test 6
  735. //MAIN
  736.  
  737. //include run\foo\a.mcbe
  738.  
  739. //macro main
  740. //do that
  741. //do this
  742.  
  743.  
  744. //A (in run/foo)
  745.  
  746. //include >\bar\bar.mcbe
  747.  
  748. //macro that
  749. // beep
  750. // rt
  751.  
  752. //B (in run/foo/bar)
  753.  
  754. //macro this
  755. //beep 500
  756. //rt
  757. }
  758.  
  759.  
  760. ==ASCII Table Reference==
  761.  
  762. Characters on the ASCII table correspond to integer values. For example, "H" is equal to 72. In MacroBeep
  763. "cout 72" prints an H.
  764.  
  765. Null 0
  766.  
  767. Beep 7
  768.  
  769. Tab 9
  770.  
  771. New Line 10
  772.  
  773. Space 32
  774.  
  775. ! 33
  776.  
  777. " 34
  778.  
  779. # 35
  780.  
  781. $ 36
  782.  
  783. % 37
  784.  
  785. & 38
  786.  
  787. ' 39
  788.  
  789. ( 40
  790.  
  791. ) 41
  792.  
  793. * 42
  794.  
  795. + 43
  796.  
  797. , 44
  798.  
  799. - 45
  800.  
  801. . 46
  802.  
  803. / 47
  804.  
  805. 0 48
  806.  
  807. 1 49
  808.  
  809. 2 50
  810.  
  811. 3 51
  812.  
  813. 4 52
  814.  
  815. 5 53
  816.  
  817. 6 54
  818.  
  819. 7 55
  820.  
  821. 8 56
  822.  
  823. 9 57
  824.  
  825. : 58
  826.  
  827. ; 59
  828.  
  829. < 60
  830.  
  831. = 61
  832.  
  833. > 62
  834.  
  835. ? 63
  836.  
  837. @ 64
  838.  
  839. A 65
  840.  
  841. B 66
  842.  
  843. C 67
  844.  
  845. D 68
  846.  
  847. E 69
  848.  
  849. F 70
  850.  
  851. G 71
  852.  
  853. H 72
  854.  
  855. I 73
  856.  
  857. J 74
  858.  
  859. K 75
  860.  
  861. L 76
  862.  
  863. M 77
  864.  
  865. N 78
  866.  
  867. O 79
  868.  
  869. P 80
  870.  
  871. Q 81
  872.  
  873. R 82
  874.  
  875. S 83
  876.  
  877. T 84
  878.  
  879. U 85
  880.  
  881. V 86
  882.  
  883. W 87
  884.  
  885. X 88
  886.  
  887. Y 89
  888.  
  889. Z 90
  890.  
  891. [ 91
  892.  
  893. \ 92
  894.  
  895. ] 93
  896.  
  897. ^ 94
  898.  
  899. _ 95
  900.  
  901. ` 96
  902.  
  903. a 97
  904.  
  905. b 98
  906.  
  907. c 99
  908.  
  909. d 100
  910.  
  911. e 101
  912.  
  913. f 102
  914.  
  915. g 103
  916.  
  917. h 104
  918.  
  919. i 105
  920.  
  921. j 106
  922.  
  923. k 107
  924.  
  925. l 108
  926.  
  927. m 109
  928.  
  929. n 110
  930.  
  931. o 111
  932.  
  933. p 112
  934.  
  935. q 113
  936.  
  937. r 114
  938.  
  939. s 115
  940.  
  941. t 116
  942.  
  943. u 117
  944.  
  945. v 118
  946.  
  947. w 119
  948.  
  949. x 120
  950.  
  951. y 121
  952.  
  953. z 122
  954.  
  955. { 123
  956.  
  957. | 124
  958.  
  959. } 125
  960.  
  961. ~ 126
  962.  
  963.  
  964.  
  965. ==Change Log (changes from v1.1.5)==
  966.  
  967. -Added various instructions for branching with relational operators
  968.  
  969. -Added labels
  970.  
  971. -Modified errors to account for labels
  972.  
  973. -Modified reader to allow for the use of the closing angle bracket in include statements
  974.  
  975. -Updated Tests
  976.  
  977. -Updated Documentation
  978.  
  979. -Added a citation for the Truth Machine program
  980.  
  981.  
  982. ==Sources==
  983.  
  984. ASCII table. ASCII Table - ASCII Character Codes, HTML, Octal, Hex, Decimal. (n.d.). Retrieved January 16, 2022, from https://www.asciitable.com/
  985.  
  986. Bf. Esolang. (n.d.). Retrieved January 16, 2022, from https://esolangs.org/wiki/Bf (Swear word removed.)
  987.  
  988. Truth-machine. Esolang. (n.d.). Retrieved February 2, 2022, from https://esolangs.org/wiki/Truth-machine
  989.  
  990. Macrobeep. Esolang. (n.d.). Retrieved January 16, 2022, from https://esolangs.org/wiki/MacroBeep
  991.  
  992. Wikimedia Foundation. (2021, December 25). Extended backus-naur form. Wikipedia. Retrieved January 17, 2022, from https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form#Table_of_Symbols
  993.  
  994. Wikimedia Foundation. (2022, January 4). Turing completeness. Wikipedia. Retrieved January 16, 2022, from https://en.wikipedia.org/wiki/Turing_completeness
  995.  
  996. Wikimedia Foundation. (2022, January 14). Turing machine. Wikipedia. Retrieved January 16, 2022, from https://en.wikipedia.org/wiki/Turing_machine
  997.  
  998. ==Contents==
  999.  
  1000. Acknowledgements
  1001. Introduction to MacroBeep
  1002. Language Paradigm and Memory
  1003. Instruction Set
  1004. The Preprocessor and Include Statements
  1005. Program Examples
  1006. Error Codes
  1007. Turing Machines and the MacroBeep Tape
  1008. Proof of Turing Completeness
  1009. Grammar in EBNF
  1010. Interpreter Test Cases in Java
  1011. ASCII Table Reference
  1012. Change Log
  1013. Sources
  1014.  
  1015. =End of Documentation (Scroll Up)=
  1016.  
  1017.  
  1018. End of Program
  1019.  
  1020.  
Advertisement
Add Comment
Please, Sign In to add comment