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
/// FileDescriptor represents a standard file stream in a system.
///
/// This enum is used to specify which standard file descriptor to use
/// for input and output operations. It is typically used in conjunction
/// with tokens that require a file descriptor to perform operations like
/// printing or reading data.
///
/// # Variants
///
/// * `STDIN` - Represents the standard input stream.
/// * `STDOUT` - Represents the standard output stream.
/// * `STDERR` - Represents the standard error stream.
/// Xasm is the main struct used to generate assembly code.
///
/// Xasm holds all the information needed to generate assembly code.
/// It contains information about variables, functions, and tokens.
///
/// The information is stored in the following fields:
///
/// * `vars` - A vector of `Vars`, which represents variables declared in the source code.
/// * `mut_vars` - A vector of `MutVars`, which represents mutable variables declared in the source code.
/// * `funcs` - A vector of `Func`, which represents functions declared in the source code.
/// * `tokens` - A vector of `Tokens`, which represents tokens declared in the source code.
///
/// To generate assembly code, the `genasm` function should be called.
/// The `genasm` function takes a `Xasm` object and an `OsConfig` object as arguments,
/// and returns a string representing the assembly code.
/// Represents a function in the Xasm assembly code.
///
/// The `Func` struct is used to define a function, including its name, arguments, body,
/// and return value. It provides the necessary structure to represent a function in the
/// assembly code generated by Xasm.
///
/// # Fields
///
/// * `name` - A `String` representing the name of the function.
/// * `args` - An `Option<Vec<Vars>>` representing the function's arguments as immutable variables.
/// * `mut_args` - An `Option<Vec<MutVars>>` representing the function's arguments as mutable variables.
/// * `body` - An `Xasm` struct representing the body of the function, which contains tokens, variables,
/// and other elements that make up the function's implementation.
/// * `ret` - An `Option<Vars>` representing the return value of the function, if any.