New page wikitext, after the edit (new_wikitext) | ''''LMCode''' — esoteric programming language. Based on the [https://en.wikipedia.org/wiki/Little_man_computer Little man computer] command system.
LMCode operates on an array of memory cells, also referred to as the [[tape]], each initially set to zero. There is a pointer, initially pointing to the first memory cell. The commands are:
{| class="wikitable"
! Command !! Description
|-
|style="background:#eaecf0"| ''',''' || Download a value from INBOX into the accumulator
|-
|style="background:#eaecf0"| '''.''' || Upload a value from the accumulator into OUTBOX
|-
|style="background:#eaecf0"| '''~''' || Download a value from the accumulator into the current memory cell
|-
|style="background:#eaecf0"| '''^''' || Upload a value from the current memory cell into the accumulator
|-
|style="background:#eaecf0"| '''>''' || Move the pointer to the right
|-
|style="background:#eaecf0"| '''<''' || Move the pointer to the left
|-
|style="background:#eaecf0"| '''+''' || Add a value from the current cell to the accumulator
|-
|style="background:#eaecf0"| '''-''' || Sub a value in the current cell from the accumulator
|-
|style="background:#eaecf0"| '''?''' || Jump to the label !
|-
|style="background:#eaecf0"| '''!''' || The label of the command ?
|-
|style="background:#eaecf0"| '''{''' || Jump to the label }
This does only work if acc>=0
|-
|style="background:#eaecf0"| '''}''' || The label of the command {
|-
|style="background:#eaecf0"| '''(''' || Jump to the label )
This does only work if acc=0
|-
|style="background:#eaecf0"| ''')''' || The label of the command (
|}
<!-- Так помечается раздел (если он нужен)-->
== Examples ==
<!-- Так помечается подраздел (если он нужен)-->
=== Double a value ===
<code>
,~+.
</code>
So the way this works is:
Download a value from INBOX into the accumulator
Download a value from the accumulator into the cell 0
Add a value from the cell 0 to the accumulator (double a value)
Upload doubled value from the accumulator into OUTBOX
=== The largest element in the list ===
To run the program, you must first upload initial values to the cells 0 and 1, then go back to the cell 0.
<code>,~>,~<</code>
Then run
<code>
^>-{^?}<^!.
</code>
The way this works is:
Upload the first value from the cell 0 into the accumulator
Move the pointer to the cell 1
Sub the second value from the accumulator
If acc>=0, jump to the label }
Upload the second value from the cell 1 into the accumulator
Jump to the label !
Move the pointer to the cell 0
Upload the first value from the cell 0 into the accumulator
Upload a value from the accumulator into OUTBOX
=== Fibonacci ===
<code>}>>^>+.~<+.~<<^>-<~{</code>
To run the program, you must first upload count of the cycles (into cell 0), decremet of the count - the natural number 1 (into cell 1), first Fibonacci number - the natural number 1 (into cell 2).
<!--
Порядок следования разделов см.
[[Википедия:Оформление статей#Структура статьи]]
-->
== See also ==
<!-- (необязательный раздел) — список внутренних ссылок на другие статьи Википедии, связанные по теме
-->
[https://en.wikipedia.org/wiki/CARDboard_Illustrative_Aid_to_Computation CARDboard Illustrative Aid to Computation]
[https://ru.wikipedia.org/wiki/URISC URISC]
[[FALSE]]
[[Brainfuck]]
== External resources ==
<!-- список внешних ссылок на основные онлайн-ресурсы (веб-сайты), содержащие информацию, использованную при написании статьи, и (или) дополнительную информацию по теме статьи
-->
[https://habr.com/post/427629 Article about LMCode, posted on habr.com]
[https://github.com/demsp/lmcode/blob/master/LMCode.c Interpreter of LMCode on github.com]' |
Lines added in edit (added_lines) | [
0 => ''''LMCode''' — esoteric programming language. Based on the [https://en.wikipedia.org/wiki/Little_man_computer Little man computer] command system. ',
1 => 'LMCode operates on an array of memory cells, also referred to as the [[tape]], each initially set to zero. There is a pointer, initially pointing to the first memory cell. The commands are:',
2 => '',
3 => '{| class="wikitable"',
4 => '',
5 => '! Command !! Description',
6 => '|-',
7 => '|style="background:#eaecf0"| ''',''' || Download a value from INBOX into the accumulator ',
8 => '|-',
9 => '|style="background:#eaecf0"| '''.''' || Upload a value from the accumulator into OUTBOX',
10 => '|-',
11 => '|style="background:#eaecf0"| '''~''' || Download a value from the accumulator into the current memory cell',
12 => '|-',
13 => '|style="background:#eaecf0"| '''^''' || Upload a value from the current memory cell into the accumulator',
14 => '|-',
15 => '|style="background:#eaecf0"| '''>''' || Move the pointer to the right',
16 => '|-',
17 => '|style="background:#eaecf0"| '''<''' || Move the pointer to the left',
18 => '|-',
19 => '|style="background:#eaecf0"| '''+''' || Add a value from the current cell to the accumulator',
20 => '|-',
21 => '|style="background:#eaecf0"| '''-''' || Sub a value in the current cell from the accumulator',
22 => '|-',
23 => '|style="background:#eaecf0"| '''?''' || Jump to the label !',
24 => '|-',
25 => '|style="background:#eaecf0"| '''!''' || The label of the command ?',
26 => '|-',
27 => '|style="background:#eaecf0"| '''{''' || Jump to the label } ',
28 => '',
29 => 'This does only work if acc>=0',
30 => '|-',
31 => '|style="background:#eaecf0"| '''}''' || The label of the command {',
32 => '|-',
33 => '|style="background:#eaecf0"| '''(''' || Jump to the label ) ',
34 => '',
35 => 'This does only work if acc=0',
36 => '|-',
37 => '|style="background:#eaecf0"| ''')''' || The label of the command (',
38 => '|}',
39 => '',
40 => '<!-- Так помечается раздел (если он нужен)-->',
41 => '',
42 => '== Examples ==',
43 => '',
44 => '<!-- Так помечается подраздел (если он нужен)-->',
45 => '=== Double a value ===',
46 => '<code>',
47 => ',~+.',
48 => '</code>',
49 => '',
50 => 'So the way this works is:',
51 => '',
52 => 'Download a value from INBOX into the accumulator',
53 => '',
54 => 'Download a value from the accumulator into the cell 0',
55 => '',
56 => 'Add a value from the cell 0 to the accumulator (double a value)',
57 => ' ',
58 => 'Upload doubled value from the accumulator into OUTBOX',
59 => ' ',
60 => '',
61 => '=== The largest element in the list ===',
62 => 'To run the program, you must first upload initial values to the cells 0 and 1, then go back to the cell 0. ',
63 => '',
64 => '<code>,~>,~<</code>',
65 => '',
66 => 'Then run',
67 => '',
68 => '<code>',
69 => '^>-{^?}<^!.',
70 => '</code>',
71 => '',
72 => 'The way this works is:',
73 => '',
74 => 'Upload the first value from the cell 0 into the accumulator',
75 => '',
76 => 'Move the pointer to the cell 1 ',
77 => '',
78 => 'Sub the second value from the accumulator',
79 => '',
80 => 'If acc>=0, jump to the label }',
81 => '',
82 => 'Upload the second value from the cell 1 into the accumulator',
83 => '',
84 => 'Jump to the label !',
85 => '',
86 => 'Move the pointer to the cell 0',
87 => '',
88 => 'Upload the first value from the cell 0 into the accumulator',
89 => '',
90 => 'Upload a value from the accumulator into OUTBOX',
91 => '',
92 => '=== Fibonacci ===',
93 => '',
94 => '<code>}>>^>+.~<+.~<<^>-<~{</code>',
95 => '',
96 => 'To run the program, you must first upload count of the cycles (into cell 0), decremet of the count - the natural number 1 (into cell 1), first Fibonacci number - the natural number 1 (into cell 2).',
97 => '<!-- ',
98 => 'Порядок следования разделов см.',
99 => '[[Википедия:Оформление статей#Структура статьи]]',
100 => '-->',
101 => '',
102 => '',
103 => '== See also ==',
104 => '<!-- (необязательный раздел) — список внутренних ссылок на другие статьи Википедии, связанные по теме',
105 => '-->',
106 => '[https://en.wikipedia.org/wiki/CARDboard_Illustrative_Aid_to_Computation CARDboard Illustrative Aid to Computation]',
107 => '',
108 => '[https://ru.wikipedia.org/wiki/URISC URISC]',
109 => '',
110 => '[[FALSE]]',
111 => '',
112 => '[[Brainfuck]]',
113 => '',
114 => '',
115 => '',
116 => '',
117 => '',
118 => '== External resources ==',
119 => '<!-- список внешних ссылок на основные онлайн-ресурсы (веб-сайты), содержащие информацию, использованную при написании статьи, и (или) дополнительную информацию по теме статьи',
120 => '-->',
121 => '[https://habr.com/post/427629 Article about LMCode, posted on habr.com]',
122 => '',
123 => '[https://github.com/demsp/lmcode/blob/master/LMCode.c Interpreter of LMCode on github.com]'
] |