You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -25,6 +26,7 @@ tar -xzvf minicode-aarch64-apple-darwin.tar
25
26
```bash
26
27
sudo mv minicode /usr/bin
27
28
```
29
+
28
30
> sudo is required to move the binary to `/usr/bin`.
29
31
30
32
You can enter the following command to verify that the installation was successful.
@@ -42,126 +44,8 @@ To update your version to the latest use the following command
42
44
```bash
43
45
sudo minicode --update
44
46
```
45
-
This command will automatically download the latest release and install it
46
-
47
-
## Tutorial
48
-
49
-
Minicode executes the code line by line. At the beginning of each line there is a command. There are currently 6 commands in the minicode.
50
-
| command | description |
51
-
|----------|----------|
52
-
| > | Assigns a value to the specified variable. Meaning, if the value can be parsed into an integer, it will do so. |
53
-
| p | Displays the value from the specified variable |
54
-
| f | Tries to find a file at the specified path, and puts all its contents into the specified variable |
55
-
| $> | Asks the user for a value, if it can be represented as an integer, it will be represented as such
56
-
| = | Start of an arithmetic operation
57
-
| ? | Start of condition
58
-
59
-
All operations on one line are separated by spaces!
60
-
61
-
### Assigning Variables
62
-
63
-
The assignment operation always has the name of the variable and the value that needs to be put into it.
64
-
65
-
For example, how to put the number 431 in variable a:
66
-
```
67
-
> a 434
68
-
```
69
-
For example, how to put the string hello world in a variable:
70
-
```
71
-
> a Hello World!
72
-
```
73
-
You can use quotes or not, if the string cannot be represented as an integer, it will remain a string.
74
-
75
-
### Console output
76
-
77
-
You can display the contents of a variable to the console using the command `p`
78
-
79
-
For example:
80
-
```
81
-
p a
82
-
```
83
-
### Reading from a file
84
-
85
-
Using the `f` command you can read from a file
86
-
87
-
For example:
88
-
```
89
-
f a test/test_file.txt
90
-
```
91
-
92
-
### Request value from user
93
-
94
-
You can request the value from the user using the command `$>`
95
-
96
-
For example:
97
-
```
98
-
$> a
99
-
```
100
-
101
-
Also, as the third parameter, you can specify the text that will be shown to the user when requesting a value. For example:
102
-
103
-
```
104
-
$> a text
105
-
```
106
-
107
-
### Arithmetic operations
108
-
109
-
Arithmetic operations are carried out through the command `a`
110
-
111
-
For example, how to add a number to a variable:
112
-
```
113
-
= a + 12
114
-
```
115
-
For example, how to subtract a number from a variable:
116
-
```
117
-
= a - 12
118
-
```
119
-
120
-
Multiplication and division are also supported. The second argument can be variables.
121
-
122
-
### Conditions and cycles
123
-
124
-
At the end of each condition there is a line number where the interpreter will go if the condition is true. Accordingly, if you send the interpreter back, you can implement loops, and if you send it forward, you can implement conditional branches.
125
-
126
-
For example, if a equals 0, move the interpreter to the fifth line:
127
-
```
128
-
? a = 0 5
129
-
```
130
-
For example, if a equals not 0, move the interpreter to the fifth line:
131
-
```
132
-
? a ! 0 5
133
-
```
134
-
135
-
Here's how, for example, to implement a loop that displays the message hello world 5 times:
136
-
137
-
```
138
-
> a 0
139
-
> b Hello world
140
-
= a + 1
141
-
p b
142
-
? a ! 5 3
143
-
```
144
-
The conditions in minicode are quite powerful for typical languages of this class. You can compare and compare all data types with each other (although there are only two of them), but only in accordance with the type. You cannot compare a number with a string. You can also compare values that are in a variable. However, when specifying a variable, keep in mind that the minicode will first try to parse the value into a number, then if that doesn’t work, it will look to see if there is a variable with that name in memory, and if not, it will consider what you specified as a regular string.
145
-
146
-
For example, the following code will display only `just text` on the screen
147
-
148
-
```
149
-
> a lol
150
-
> b lol
151
-
? a = b 6
152
-
p a
153
-
p b
154
-
> c 245
155
-
> d 345
156
-
? c ! d 11
157
-
p c
158
-
p d
159
-
> text just text
160
-
p text
161
-
```
162
-
163
-
You will find more examples in the folder -> test/examples
164
47
48
+
This command will automatically download the latest release and install it
0 commit comments