PixelatedStarfish

Mbv130

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