1
- %include "utils/printf32.asm"
2
1
section .data
3
2
delim db " " , 0
4
3
@@ -12,7 +11,6 @@ section .text
12
11
13
12
extern evaluate_ast
14
13
extern create_node
15
- extern printf
16
14
global create_tree
17
15
global iocla_atoi
18
16
@@ -31,21 +29,17 @@ iocla_atoi: ;change string to number
31
29
mov [ isNegativeAtoi ], edx ;the default way is that the number is positive
32
30
;we check to see if the number is negative or not
33
31
mov bl , [ eax ]
34
- cmp bl , '-' ;compare to minus character
35
- jnz atoi_loop ;if it is not a minus sign just do the rest as usual
32
+ cmp bl , '-' ;compare to minus character
33
+ jnz atoi_loop ;if it is not a minus sign just do the rest as usual
36
34
mov edx , 1
37
35
mov [ isNegativeAtoi ], edx ;change global variable
38
36
inc eax ;get rid of the minus
39
37
40
38
atoi_loop:
41
- mov bl , [ eax ] ;get the character
42
- test bl , bl ;check if we reached the end
39
+ mov bl , [ eax ] ;get the character
40
+ test bl , bl ;check if we reached the end
43
41
jz end_of_atoi
44
- cmp bl , ' '
45
- jz end_of_atoi
46
- cmp bl , 10
47
- jz end_of_atoi
48
- imul ecx , 0xa ;multiply ecx by 10
42
+ imul ecx , 0xa ;multiply ecx by 10
49
43
sub bl , '0'
50
44
add ecx , ebx
51
45
inc eax
@@ -128,7 +122,6 @@ is_a_minus:
128
122
jmp end
129
123
130
124
is_an_operator:
131
- ;PRINTF32 `OPERATOR:%c:OPERATOR\n\x0`,ecx
132
125
mov ebx , 0x1
133
126
mov [ isOperator ], ebx
134
127
@@ -155,8 +148,6 @@ create_tree:
155
148
pop ecx ;restoring ecx register
156
149
pop eax ;restoring eax register
157
150
158
- ;PRINTF32 `DA:%s:DA\n\x0`,edx
159
-
160
151
;initializing root Node
161
152
push edx ;pushing parameter
162
153
call create_node
@@ -180,14 +171,6 @@ traverse_token:
180
171
pop ecx ;restoring ecx register
181
172
pop eax ;restoring eax register
182
173
183
- ;PRINTF32 `DA:%s:DA\n\x0`,edx
184
-
185
- ;push ecx
186
- ;mov ecx, [currentNode]
187
- ;mov ecx, [ecx]
188
- ;PRINTF32 `INLINE:%s:INLINE\n\x0`,ecx
189
- ;pop ecx
190
-
191
174
push ebx ;saving ebx register
192
175
push ecx ;saving ecx register
193
176
push edx ;saving edx register
@@ -291,19 +274,6 @@ loop_for_poping_remaining_nodes:
291
274
very_end:
292
275
mov eax , [ root ] ;put in eax the root
293
276
294
- ;mov ecx, [eax + 0x8] ; left of "+"
295
- ;mov ecx, [ecx + 0x4] ; right of "*"
296
- ;mov ecx, [ecx + 4] ; right of "/"
297
- ;mov ecx, [ecx + 4]
298
- ;mov ecx, [ecx] ;
299
-
300
- ;push eax
301
- ;push ecx
302
- ;call iocla_atoi
303
- ;PRINTF32 `SFARSIT:%d:SFARSIT\n\x0`,eax
304
- ;add esp, 0x4
305
- ;pop eax
306
-
307
277
pop edx
308
278
pop ecx
309
279
pop ebx
0 commit comments