-
Notifications
You must be signed in to change notification settings - Fork 0
/
documentation.txt
171 lines (132 loc) · 5.34 KB
/
documentation.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/-----------------------------------------------------------------------------\
| ______ _ |
| |___ / | | |
| / / ___| |__ _ __ __ _ |
| / / / _ \ '_ \| '__/ _` | |
| ./ /__| __/ |_) | | | (_| | |
| \_____/\___|_.__/|_| \__,_| |
| |
\-----------------------------------------------------------------------------/
SYNTAX :
Comments:
# <your comment>
Commands are separated by line breaks (\n) or semicolons (;).
Import other contents:
import <library> # other installed library
import <code_path> # other code file to import
Types and variables:
defined variable => <name> = <value> # variable with it's value
not defined variable => <type> <name> # minimum size variable without value
int => variable bits
int64 => 64 bits
float => 128 bits
list => list
tuple => tuple
dict => dict
str => 32 bits utf8
stra => 8 bits ASCII
bool => 8 bits
int => 42 # int value
float => 3.14159265 # float value
string => "string" # List of characters (string)
list => [1, "hey", 3] # List of values (list)
tuple => (1, "hey", 2) # Tuple, with at least one comma in the parenthesis
dictionnary => {"name" => "Lucas", "age" => 3} # Dictionary of values (dict)
booleen => true/false # Boolean (bool)
None => None # zero value (None)
Operators:
operators => [=, +, -, *, /, //, ^, % (modulo)]
condensed operators => [+=, -=, *=, /=, //=, ^=, %=]
comparative operators => [==, !=, >, <, >=, <=, in, not]
logics operators => [and, or, xor, nand, nor, nxor]
list range => [<start> : <end> : <step>] # interval of a list
Conditions:
condition => if (<condition>) {}
else if => elif (<condition>) {}
else => else {}
Loops :
conditional loop => while (<condition>) {}
loop for => for (<variable>, <iterable>) {}
Priorities from left to right:
++++++++ "()", "[]", "{}"
+++++++ "="
++++++ "and", "or", "xor", "in", "nand", "nor", "xnor", "nin"
+++++ "<", ">", "<=", ">=", "!=", "=="
++++ "+", "-"
+++ "*", "/", "//", "%"
++ "^"
+ "." #OPP
Functions:
definie functions => def <name>(<parameters>) {}
call a function => <name>(<parameters>)
Objects:
attributes => <object>.<attribut>
functions => <objects>.<functions>()
Basic functions:
print(<message(s)>) # display value(s) separated by commas
input(<message(s)>) # displays the message and requests a value
not(<bool>) # invert boolean value
len(<list>) # length of a list
range(<start>, <end>, <step>) # list creation (range)
max(<list>) # maximum value of a list
min(<list>) # minimum value of a list
round(<value>) # rounded to the nearest whole number
floor(<value>) # rounded up to the nearest whole number
cell(<value>) # rounded down to the nearest whole number
int(<value>) # converts a value to an integer if possible
float(<value>) # converts a value to a float if possible
str(<value>) # converts a value to a ut8 string if possible
stra(<value>) # converts a value to a ascii string if possible
RESTRICTIONS :
Never use variable or a function named with special caracters.
And specifically like that :
$<name>
$my_variable = 5
$stupid_variable = "hello"
Variable and functions named $<name> are use in internal for library and assembly code
If you use variable named like that you risk to modify variables in assembly code
DOCUMENTATION :
## print(msg=str, last_chr=str)
=> display to the terminal
input:
msg, string, message to display
last_chr, string, message to be displayed after main message display
ouput:
None
## exit(msg=bool)
=> exit the programme, with or not message
input:
msg, boolean, 1 exit with message, 0 exit without message
ouput:
None
## hello_world(None)
=> print "Hello world!"
input:
nothing
ouput:
None
HOW IT WORK :
The stack:
In generated assembly, the arguments are passed in the stack.
Passed from left-to-right
ex :
function(arg1, arg2, arg3)
=>
push arg1
push arg2
push arg3
call function
Variables:
Each variables are do like this:
- Anchor -----------------
| |
| - Value ------------ |
| | | |
| | | |
| -------------------- |
|------------------------|
The advantage is we can change the variable value like we want.
The "Anchor" is here to keep in memory the pointer to the value.
The disadvantage is a value will require more memory to store a value.
One solution is to create a specific type of variable that does not use the anchoring system,
the value requires less memory, but can be modified as required.