start translation phase 4
This commit is contained in:
parent
ac6cb985db
commit
3d0adb5f6f
5 changed files with 245 additions and 4 deletions
18
05/main.b
18
05/main.b
|
@ -8,6 +8,13 @@ byte 0
|
|||
byte 0
|
||||
goto main
|
||||
|
||||
|
||||
global object_macros_size
|
||||
global function_macros_size
|
||||
; these are allocated in main()
|
||||
global object_macros
|
||||
global function_macros
|
||||
|
||||
function compile_error
|
||||
argument file
|
||||
argument line
|
||||
|
@ -15,12 +22,12 @@ function compile_error
|
|||
fputs(2, file)
|
||||
fputc(2, ':)
|
||||
fputn(2, line)
|
||||
fputs(2, .str_error)
|
||||
fputs(2, .str_error_prefix)
|
||||
fputs(2, message)
|
||||
fputc(2, 10)
|
||||
exit(1)
|
||||
|
||||
:str_error
|
||||
:str_error_prefix
|
||||
string : Error:
|
||||
byte 32
|
||||
byte 0
|
||||
|
@ -38,6 +45,9 @@ function main
|
|||
local output_filename
|
||||
local pptokens
|
||||
|
||||
object_macros = malloc(4000000)
|
||||
function_macros = malloc(4000000)
|
||||
|
||||
input_filename = .str_default_input_filename
|
||||
output_filename = .str_default_output_filename
|
||||
if argc == 1 goto have_filenames
|
||||
|
@ -47,6 +57,10 @@ function main
|
|||
:have_filenames
|
||||
pptokens = split_into_preprocessing_tokens(input_filename)
|
||||
print_pptokens(pptokens)
|
||||
print_separator()
|
||||
pptokens = translation_phase_4(input_filename, pptokens)
|
||||
;print_pptokens(pptokens)
|
||||
print_object_macros()
|
||||
exit(0)
|
||||
|
||||
:usage_error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue