|
|
|
@ -253,7 +253,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; read_all_tokens function
|
|
|
|
|
;; Recieves Token_List* in EAX
|
|
|
|
|
;; Receives Token_List* in EAX
|
|
|
|
|
;; Tokenizes all input and returns updated list in EAX
|
|
|
|
|
;; Returns TOKEN in EAX
|
|
|
|
|
;; Uses EAX for C
|
|
|
|
@ -271,7 +271,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; get_token function
|
|
|
|
|
;; Recieves INT in EAX
|
|
|
|
|
;; Receives INT in EAX
|
|
|
|
|
;; Makes a list of TOKEN_LIST
|
|
|
|
|
;; C and STRING_INDEX are stored in memory, ECX is used for S and EDX is used for current
|
|
|
|
|
;; Returns C in EAX
|
|
|
|
@ -434,7 +434,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; clear_white_space function
|
|
|
|
|
;; Recieves INT C in EAX
|
|
|
|
|
;; Receives INT C in EAX
|
|
|
|
|
;; Returns first non-whitespace char in EAX
|
|
|
|
|
:clear_white_space
|
|
|
|
|
CMPI8_EAX !32 ; Check for ' '
|
|
|
|
@ -457,7 +457,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; In_Set function
|
|
|
|
|
;; Recieves Char C in EAX and CHAR* in EBX
|
|
|
|
|
;; Receives Char C in EAX and CHAR* in EBX
|
|
|
|
|
;; Returns 1 if true, zero if false in EAX
|
|
|
|
|
:In_Set
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -493,7 +493,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; purge_macro function
|
|
|
|
|
;; Recieves CH in EAX
|
|
|
|
|
;; Receives CH in EAX
|
|
|
|
|
;; Reads chars until Line feed is read
|
|
|
|
|
;; returns line feed
|
|
|
|
|
:purge_macro
|
|
|
|
@ -504,7 +504,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; preserve_keyword function
|
|
|
|
|
;; Recieves INT C in EAX
|
|
|
|
|
;; Receives INT C in EAX
|
|
|
|
|
;; collects all chars in keyword
|
|
|
|
|
;; Returns C in EAX
|
|
|
|
|
;; Uses ECX for INT C
|
|
|
|
@ -539,7 +539,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; preserve_symbol function
|
|
|
|
|
;; Recieves INT C in EAX
|
|
|
|
|
;; Receives INT C in EAX
|
|
|
|
|
;; collects all chars in symbol
|
|
|
|
|
;; Returns C in EAX
|
|
|
|
|
;; Uses ECX for INT C
|
|
|
|
@ -566,7 +566,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; consume_word function
|
|
|
|
|
;; recieves INT C in EAX
|
|
|
|
|
;; receives INT C in EAX
|
|
|
|
|
;; returns INT C in EAX
|
|
|
|
|
;; Uses EAX for C, EBX for FREQ and ECX for ESCAPE
|
|
|
|
|
:consume_word
|
|
|
|
@ -603,7 +603,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; consume_byte function
|
|
|
|
|
;; Recieves INT C in EAX
|
|
|
|
|
;; Receives INT C in EAX
|
|
|
|
|
;; Inserts C into string S, updates String S
|
|
|
|
|
;; Returns Next char in EAX
|
|
|
|
|
:consume_byte
|
|
|
|
@ -618,7 +618,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; fixup_label function
|
|
|
|
|
;; Recieves S in ECX
|
|
|
|
|
;; Receives S in ECX
|
|
|
|
|
;; prepends ':' to string and returns registers un changed
|
|
|
|
|
;; Uses EAX for HOLD, EBX for PREV and ECX for S[0]
|
|
|
|
|
:fixup_label
|
|
|
|
@ -668,7 +668,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Reverse_List function
|
|
|
|
|
;; Recieves List in EAX
|
|
|
|
|
;; Receives List in EAX
|
|
|
|
|
;; Returns the list reversed in EAX
|
|
|
|
|
:Reverse_List
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -692,7 +692,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; recursive_output function
|
|
|
|
|
;; Recieves list in EAX
|
|
|
|
|
;; Receives list in EAX
|
|
|
|
|
;; walks the list and prints the I->S for all nodes backwards
|
|
|
|
|
;; Uses EBX for I
|
|
|
|
|
:recursive_output
|
|
|
|
@ -715,7 +715,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; File_Print function
|
|
|
|
|
;; Recieves CHAR* in EAX
|
|
|
|
|
;; Receives CHAR* in EAX
|
|
|
|
|
;; calls fputc for every non-null char
|
|
|
|
|
:File_Print
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -740,7 +740,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; fputc function
|
|
|
|
|
;; recieves CHAR in EAX and load FILE* from [OUTPUT_FILE]
|
|
|
|
|
;; receives CHAR in EAX and load FILE* from [OUTPUT_FILE]
|
|
|
|
|
;; writes char and returns
|
|
|
|
|
:fputc
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -760,7 +760,7 @@ DEFINE SWAP_EAX_EBX 93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; program function
|
|
|
|
|
;; recieves nothing, returns nothing
|
|
|
|
|
;; receives nothing, returns nothing
|
|
|
|
|
;; Uses EAX for type_size
|
|
|
|
|
:program
|
|
|
|
|
;; The binary initialized the globals to null, so we can skip those steps
|
|
|
|
@ -870,7 +870,7 @@ NOP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; declare_function function
|
|
|
|
|
;; Recieves nothing and returns nothing
|
|
|
|
|
;; Receives nothing and returns nothing
|
|
|
|
|
;; Sets current function and adds it to the global function list
|
|
|
|
|
:declare_function
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -949,7 +949,7 @@ NOP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; collect_arguments function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Adds arguments to the function definition
|
|
|
|
|
;; holds struct type* type_size in ECX, then replace with struct token_list* a in ECX when type_size is used
|
|
|
|
@ -1045,7 +1045,7 @@ NOP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; statement function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Walks down global_token recursively to collect the contents of the function
|
|
|
|
|
:statement
|
|
|
|
@ -1242,7 +1242,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; recursive_statement function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Walks the global_token list to build the contents of statements
|
|
|
|
|
;; Uses struct token_list* frame in ECX
|
|
|
|
@ -1309,7 +1309,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; return_result function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Cleans up function and generates return
|
|
|
|
|
;; Also handles returing expressions
|
|
|
|
@ -1361,7 +1361,7 @@ MISSING ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; collect_local function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Walks global_token list to create function locals
|
|
|
|
|
;; Uses ECX for struct token_list* A
|
|
|
|
@ -1496,7 +1496,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; process_asm function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Simply inlines the asm statements
|
|
|
|
|
;; Uses EBX for global_token temp storage
|
|
|
|
@ -1555,7 +1555,7 @@ MISSING ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; process_if function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Increments current_count recurses into expression + statement
|
|
|
|
|
;; Uses ECX for char* NUMBER_STRING
|
|
|
|
@ -1694,7 +1694,7 @@ MISSING )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; set_break_frame microfunction
|
|
|
|
|
;; Recieves char* head in EAX and char* num in EBX
|
|
|
|
|
;; Receives char* head in EAX and char* num in EBX
|
|
|
|
|
;; Overwrites EAX and EBX
|
|
|
|
|
;; Returns to calling function
|
|
|
|
|
:set_break_frame
|
|
|
|
@ -1709,7 +1709,7 @@ MISSING )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; process_do function
|
|
|
|
|
;; Recieves Nothing
|
|
|
|
|
;; Receives Nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Increments current_count and leverages save/restore_break_frame pieces
|
|
|
|
|
;; Uses ECX for char* NUMBER_STRING
|
|
|
|
@ -1802,7 +1802,7 @@ JUMP_NE %DO_"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; process_while function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Increments current_count and leverages save/restore_break_frame pieces
|
|
|
|
|
;; Uses ECX for char* NUMBER_STRING
|
|
|
|
@ -1898,7 +1898,7 @@ MISSING )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; process_for function
|
|
|
|
|
;; Recieves Nothing
|
|
|
|
|
;; Receives Nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Increments current_count and leverages save/restore_break_frame pieces
|
|
|
|
|
;; Uses ECX for char* NUMBER_STRING
|
|
|
|
@ -2055,7 +2055,7 @@ MISSING )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; process_break function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Handles the break out of loops case
|
|
|
|
|
;; Uses EBX for struct token_list* break_frame and ECX for struct token_list* I
|
|
|
|
@ -2137,7 +2137,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; expression function
|
|
|
|
|
;; Recieves Nothing
|
|
|
|
|
;; Receives Nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Walks global_token and updates output_list
|
|
|
|
|
;; Uses EAX and EBX for match and ECX for char* store
|
|
|
|
@ -2195,7 +2195,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; bitwise_expr function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Walks global_token list and updates output list
|
|
|
|
|
;; Just calls other functions
|
|
|
|
@ -2206,7 +2206,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; bitwise_expr_stub function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Just calls general_recursion a bunch
|
|
|
|
|
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
|
|
|
@ -2259,7 +2259,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; relational_expr function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Walks global_token list and updates output list
|
|
|
|
|
;; just calls other function
|
|
|
|
@ -2270,7 +2270,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; relational_expr_stub function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Just calls general_recursion a bunch
|
|
|
|
|
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
|
|
|
@ -2347,7 +2347,7 @@ MOVEZBL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; additive_expr function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Walks global_token list and updates output list
|
|
|
|
|
;; just calls other function
|
|
|
|
@ -2358,7 +2358,7 @@ MOVEZBL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; additive_expr_stub function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Just calls general_recursion a bunch
|
|
|
|
|
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
|
|
|
@ -2441,7 +2441,7 @@ SAR_eax_cl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; postfix_expr function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Walks global_token list and updates output list
|
|
|
|
|
;; just calls other function
|
|
|
|
@ -2452,7 +2452,7 @@ SAR_eax_cl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; postfix_expr_stub function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Checks for "[" and "->" and deals with them otherwise does nothing
|
|
|
|
|
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
|
|
|
@ -2485,7 +2485,7 @@ SAR_eax_cl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; unary_expr_sizeof function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Uses ECX for A->SIZE
|
|
|
|
|
:unary_expr_sizeof
|
|
|
|
@ -2532,7 +2532,7 @@ Missing )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; postfix_expr_array function
|
|
|
|
|
;; Recieves Nothing
|
|
|
|
|
;; Receives Nothing
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Uses EBX for struct type* ARRAY and ECX for char* ASSIGN
|
|
|
|
|
:postfix_expr_array
|
|
|
|
@ -2616,7 +2616,7 @@ Missing ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; ceil_log2 function
|
|
|
|
|
;; Recieves int a in EAX
|
|
|
|
|
;; Receives int a in EAX
|
|
|
|
|
;; Performs log2 on A and
|
|
|
|
|
;; Returns result in EAX
|
|
|
|
|
;; Uses EBX for INT A and ECX for INT RESULT
|
|
|
|
@ -2649,7 +2649,7 @@ Missing ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; postfix_expr_arrow function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Emits a bunch and updates current_target
|
|
|
|
|
;; Uses EBX for struct type* I
|
|
|
|
@ -2722,7 +2722,7 @@ ADD_ebx_to_eax
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; primary_expr function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
:primary_expr
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -2888,7 +2888,7 @@ Didn't get )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; primary_expr_variable function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Walks global and updates output
|
|
|
|
|
;; Uses EAX for struct token_list* a and ECX for char* S
|
|
|
|
@ -2988,7 +2988,7 @@ Didn't get )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; function_call function
|
|
|
|
|
;; Recieves char* S in EAX and int BOOL in EBX
|
|
|
|
|
;; Receives char* S in EAX and int BOOL in EBX
|
|
|
|
|
;; Builds stack frames before and tears them down after function calls
|
|
|
|
|
;; Uses ECX for char* S, EDX for int BOOL, ESI for PASSED
|
|
|
|
|
:function_call
|
|
|
|
@ -3149,7 +3149,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; variable_load function
|
|
|
|
|
;; Recieves struct token_list* A in EAX
|
|
|
|
|
;; Receives struct token_list* A in EAX
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Updates output and current_target
|
|
|
|
|
;; Uses ECX for A
|
|
|
|
@ -3218,7 +3218,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; function_load function
|
|
|
|
|
;; Recieves struct token_list* a in EAX
|
|
|
|
|
;; Receives struct token_list* a in EAX
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Uses ECX to hold A->S
|
|
|
|
|
:function_load
|
|
|
|
@ -3260,7 +3260,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; global_load function
|
|
|
|
|
;; Recieves struct token_list* A in EAX
|
|
|
|
|
;; Receives struct token_list* A in EAX
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Uses EBX to hold A->S
|
|
|
|
|
:global_load
|
|
|
|
@ -3303,7 +3303,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; sym_lookup function
|
|
|
|
|
;; Recieves char* S in EAX and struct token_list* symbol_list in EBX
|
|
|
|
|
;; Receives char* S in EAX and struct token_list* symbol_list in EBX
|
|
|
|
|
;; Uses I->S in EAX, S in EBX and I in ECX
|
|
|
|
|
;; Returns match or NULL
|
|
|
|
|
:sym_lookup
|
|
|
|
@ -3331,7 +3331,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; primary_expr_number function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Simply uses current global token to update output and then steps to next global_token
|
|
|
|
|
:primary_expr_number
|
|
|
|
@ -3356,7 +3356,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; primary_expr_string function
|
|
|
|
|
;; recieves nothing
|
|
|
|
|
;; receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; creates entries for string and calls to generate string output
|
|
|
|
|
;; uses ECX for char* number_string
|
|
|
|
@ -3410,7 +3410,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; primary_expr_char function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Updates output_list using global_token
|
|
|
|
|
:primary_expr_char
|
|
|
|
@ -3442,14 +3442,14 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; primary_expr_failure function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Does not return but aborts hard
|
|
|
|
|
;; Complains about the bad input
|
|
|
|
|
:primary_expr_failure
|
|
|
|
|
; CALL32 %line_error ; Get line of issue
|
|
|
|
|
LOADI32_EAX %2 ; Using Standard error
|
|
|
|
|
STORE32_Absolute32_eax &Output_file ; write to standard error
|
|
|
|
|
LOADI32_EAX &primary_expr_failure_string_0 ; Using "Recieved "
|
|
|
|
|
LOADI32_EAX &primary_expr_failure_string_0 ; Using "Received "
|
|
|
|
|
CALL32 %File_Print ; Print it
|
|
|
|
|
|
|
|
|
|
LOAD32_Absolute32_eax &global_token ; Using global_token
|
|
|
|
@ -3460,13 +3460,13 @@ LOAD_INTEGER
|
|
|
|
|
CALL32 %File_Print ; Print it
|
|
|
|
|
JMP32 %Exit_Failure ; Abort Hard
|
|
|
|
|
|
|
|
|
|
:primary_expr_failure_string_0 "Recieved "
|
|
|
|
|
:primary_expr_failure_string_0 "Received "
|
|
|
|
|
:primary_expr_failure_string_1 " in primary_expr
|
|
|
|
|
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; general_recursion function
|
|
|
|
|
;; Recieves FUNCTION F in EAX, char* S in EBX, char* name in ECX and FUNCTION iterate in EDX
|
|
|
|
|
;; Receives FUNCTION F in EAX, char* S in EBX, char* name in ECX and FUNCTION iterate in EDX
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Uses ECX for char* S, EDX for FUNCTION iterate and EBP for FUNCTION F
|
|
|
|
|
;; But generally recurses a shitload
|
|
|
|
@ -3504,7 +3504,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; promote_type function
|
|
|
|
|
;; Recieves struct type* a in EAX and struct type* b in EBX
|
|
|
|
|
;; Receives struct type* a in EAX and struct type* b in EBX
|
|
|
|
|
;; Returns the most recent type in EAX
|
|
|
|
|
;; Uses EAX for struct type* I, ECX for struct type* A and EDX for struct type* B
|
|
|
|
|
:promote_type
|
|
|
|
@ -3555,7 +3555,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; common_recursion function
|
|
|
|
|
;; Recieves FUNCTION F in EAX
|
|
|
|
|
;; Receives FUNCTION F in EAX
|
|
|
|
|
;; Returns Nothing
|
|
|
|
|
;; Walks global_token list and update output_list
|
|
|
|
|
;; Updates current_target
|
|
|
|
@ -3589,7 +3589,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; require_match function
|
|
|
|
|
;; Recieves char* message in EAX and char* required in EBX
|
|
|
|
|
;; Receives char* message in EAX and char* required in EBX
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Uses ECX to hold message and updates global_token
|
|
|
|
|
:require_match
|
|
|
|
@ -3620,7 +3620,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; uniqueID Function
|
|
|
|
|
;; Recieves char*S in EAX, struct token_list* l in EBX snd char* num in ECX
|
|
|
|
|
;; Receives char*S in EAX, struct token_list* l in EBX snd char* num in ECX
|
|
|
|
|
;; Returns updated struct token_list* L in EAX
|
|
|
|
|
:uniqueID
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -3644,7 +3644,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; uniqueID_out function
|
|
|
|
|
;; Recieves char* S in EAX and char* num in EBX
|
|
|
|
|
;; Receives char* S in EAX and char* num in EBX
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
:uniqueID_out
|
|
|
|
|
PUSH_EAX ; Protect EAX
|
|
|
|
@ -3661,7 +3661,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; emit_out function
|
|
|
|
|
;; Recieves char* S in EAX
|
|
|
|
|
;; Receives char* S in EAX
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Updates output_list
|
|
|
|
|
;; MUST NOT ALTER REGISTERS
|
|
|
|
@ -3677,7 +3677,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; emit function
|
|
|
|
|
;; Recieves char *s in EAX and struct token_list* head in EBX
|
|
|
|
|
;; Receives char *s in EAX and struct token_list* head in EBX
|
|
|
|
|
;; Returns struct token_list* T in EAX
|
|
|
|
|
:emit
|
|
|
|
|
PUSH_ECX ; Protect ECX
|
|
|
|
@ -3691,9 +3691,9 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; escape_lookup function
|
|
|
|
|
;; Recieves char* c in EAX
|
|
|
|
|
;; Receives char* c in EAX
|
|
|
|
|
;; Returns integer value of char in EAX
|
|
|
|
|
;; Aborts hard if unknown escape is recieved
|
|
|
|
|
;; Aborts hard if unknown escape is received
|
|
|
|
|
;; Uses ECX to hold char* C
|
|
|
|
|
:escape_lookup
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -3737,7 +3737,7 @@ LOAD_INTEGER
|
|
|
|
|
;; Aborting hard
|
|
|
|
|
LOADI32_EAX %2 ; Using Standard error
|
|
|
|
|
STORE32_Absolute32_eax &Output_file ; write to standard error
|
|
|
|
|
LOADI32_EAX &escape_lookup_string_0 ; Using "Unknown escape recieved: "
|
|
|
|
|
LOADI32_EAX &escape_lookup_string_0 ; Using "Unknown escape received: "
|
|
|
|
|
CALL32 %File_Print ; Print it
|
|
|
|
|
COPY_ECX_to_EAX ; Using C
|
|
|
|
|
CALL32 %File_Print ; Print it
|
|
|
|
@ -3765,13 +3765,13 @@ LOAD_INTEGER
|
|
|
|
|
ADD_ebx_into_eax ; hex(c[2]) << 4 + hex(c[3])
|
|
|
|
|
JMP32 %escape_lookup_done ; Be done
|
|
|
|
|
|
|
|
|
|
:escape_lookup_string_0 "Unknown escape recieved: "
|
|
|
|
|
:escape_lookup_string_0 "Unknown escape received: "
|
|
|
|
|
:escape_lookup_string_1 " Unable to process
|
|
|
|
|
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; char2hex function
|
|
|
|
|
;; Recieves char in EAX
|
|
|
|
|
;; Receives char in EAX
|
|
|
|
|
;; Returns hex or aborts hard
|
|
|
|
|
:char2hex
|
|
|
|
|
SUBI8_EAX !48 ; Try 0-9
|
|
|
|
@ -3802,7 +3802,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; parse_string function
|
|
|
|
|
;; Recieves char* string in EAX
|
|
|
|
|
;; Receives char* string in EAX
|
|
|
|
|
;; Returns cleaned up string
|
|
|
|
|
;; Protects char* string in EBX
|
|
|
|
|
:parse_string
|
|
|
|
@ -3827,7 +3827,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; weird function
|
|
|
|
|
;; Recieves char* string in EAX
|
|
|
|
|
;; Receives char* string in EAX
|
|
|
|
|
;; Returns true(0) or false(1) in EAX
|
|
|
|
|
;; Uses ECX to hold char* string
|
|
|
|
|
:weird
|
|
|
|
@ -3898,7 +3898,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; collect_regular_string function
|
|
|
|
|
;; Recieves char* string in EAX
|
|
|
|
|
;; Receives char* string in EAX
|
|
|
|
|
;; Malloc and creates new string to return in EAX
|
|
|
|
|
;; Uses ECX for return string and EDX for passed string
|
|
|
|
|
:collect_regular_string
|
|
|
|
@ -3954,7 +3954,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; collect_weird_string function
|
|
|
|
|
;; Recieves char* string in EAX
|
|
|
|
|
;; Receives char* string in EAX
|
|
|
|
|
;; Mallocs and returns char* hold in EAX
|
|
|
|
|
;; Uses ECX for char* hold and EDX for char* string
|
|
|
|
|
:collect_weird_string
|
|
|
|
@ -4022,7 +4022,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; HEX to ascii routine
|
|
|
|
|
;; Recieves INT in EAX and CHAR* in ECX
|
|
|
|
|
;; Receives INT in EAX and CHAR* in ECX
|
|
|
|
|
;; Stores ascii of INT in CHAR*
|
|
|
|
|
;; Returns only modifying EAX and ECX
|
|
|
|
|
:hex8
|
|
|
|
@ -4043,7 +4043,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; type_name function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns type_size in EAX
|
|
|
|
|
;; Uses ECX for STRUCT TYPE* RET
|
|
|
|
|
:type_name
|
|
|
|
@ -4131,7 +4131,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; lookup_type function
|
|
|
|
|
;; Recieves char* s in EAX and struct type* start in EBX
|
|
|
|
|
;; Receives char* s in EAX and struct type* start in EBX
|
|
|
|
|
;; Returns struct type* in EAX
|
|
|
|
|
;; Uses EBX for S and ECX for I
|
|
|
|
|
:lookup_type
|
|
|
|
@ -4159,7 +4159,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; create_struct function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; Returns nothing
|
|
|
|
|
;; Uses global_token to malloc a struct's definition
|
|
|
|
|
;; Uses ECX for int OFFSET, EDX for struct type* head, EBP for struct type* I,
|
|
|
|
@ -4280,7 +4280,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; lookup_member function
|
|
|
|
|
;; Recieves struct type* parent in EAX and char* name in EBX
|
|
|
|
|
;; Receives struct type* parent in EAX and char* name in EBX
|
|
|
|
|
;; Returns struct type* I in EAX
|
|
|
|
|
;; Uses char* NAME in EBX, ECX for struct type* I and EDX to hold parent for errors
|
|
|
|
|
;; Aborts hard if not found
|
|
|
|
@ -4340,7 +4340,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; build_member function
|
|
|
|
|
;; Recieves struct type* last in EAX, int offset in EBX and global member_size in EDI
|
|
|
|
|
;; Receives struct type* last in EAX, int offset in EBX and global member_size in EDI
|
|
|
|
|
;; Updates member_size in EDI and returns struct type* I in EAX
|
|
|
|
|
;; Uses ECX for struct type* member_type and EDX for struct type* I
|
|
|
|
|
:build_member
|
|
|
|
@ -4410,7 +4410,7 @@ LOAD_INTEGER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; build_union function
|
|
|
|
|
;; Recieves struct type* last in EAX, int offset in EBX and global member_size in EDI
|
|
|
|
|
;; Receives struct type* last in EAX, int offset in EBX and global member_size in EDI
|
|
|
|
|
;; Updates member_size in EDI and returns struct type* LAST in EAX
|
|
|
|
|
;; Uses ECX for struct type* last, EDX for int offset, ESI for int size and EDI for int member_size
|
|
|
|
|
:build_union
|
|
|
|
@ -4480,7 +4480,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; sym_declare function
|
|
|
|
|
;; Recieves char *s in EAX, struct type* t in EBX, and struct token_list* list in ECX
|
|
|
|
|
;; Receives char *s in EAX, struct type* t in EBX, and struct token_list* list in ECX
|
|
|
|
|
;; Returns struct token_list* in EAX
|
|
|
|
|
;; Uses EAX for A
|
|
|
|
|
:sym_declare
|
|
|
|
@ -4496,7 +4496,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; match function
|
|
|
|
|
;; Recieves CHAR* in EAX and CHAR* in EBX
|
|
|
|
|
;; Receives CHAR* in EAX and CHAR* in EBX
|
|
|
|
|
;; Returns 0 (TRUE) or 1 (FALSE) in EAX
|
|
|
|
|
:match
|
|
|
|
|
PUSH_EBX ; Protect EBX
|
|
|
|
@ -4528,7 +4528,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; numerate_number function
|
|
|
|
|
;; Recieves an INT A in EAX
|
|
|
|
|
;; Receives an INT A in EAX
|
|
|
|
|
;; Returns char* result in EAX
|
|
|
|
|
;; Allocates 16 bytes of memory
|
|
|
|
|
;; Behaves badly when given a negative number too large
|
|
|
|
@ -4608,7 +4608,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; numerate_string function
|
|
|
|
|
;; Recieves CHAR* in EAX
|
|
|
|
|
;; Receives CHAR* in EAX
|
|
|
|
|
;; Returns value of CHAR* in EAX
|
|
|
|
|
;; Uses EAX for VALUE, EBX for S, ECX for CH and ESI for NEGATIVE?
|
|
|
|
|
:numerate_string
|
|
|
|
@ -4691,7 +4691,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Exit_Failure function
|
|
|
|
|
;; Recieves nothing
|
|
|
|
|
;; Receives nothing
|
|
|
|
|
;; And aborts hard
|
|
|
|
|
;; Does NOT return
|
|
|
|
|
:Exit_Failure
|
|
|
|
@ -4837,7 +4837,7 @@ Missing ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; debug_list function
|
|
|
|
|
;; Recieves struct token_list* in EAX
|
|
|
|
|
;; Receives struct token_list* in EAX
|
|
|
|
|
;; Prints contents of list and exits
|
|
|
|
|
;; Does NOT return
|
|
|
|
|
:debug_list
|
|
|
|
|