Generate top-level code from symbol tables

This commit is contained in:
2025-06-19 14:03:03 +02:00
parent f524311f06
commit 6da2a70329
14 changed files with 434 additions and 397 deletions

View File

@ -75,24 +75,24 @@ type
_defer,
exclamation,
arrow,
trait,
_program,
_module,
_import
trait,
_program,
_module,
_import
);
Position* = record
line: Word;
column: Word
column: Word
end;
Location* = record
first: Position;
last: Position
last: Position
end;
SourceFile* = record
buffer: [1024]Char;
handle: ^FILE;
size: Word;
index: Word
buffer: [1024]Char;
handle: ^FILE;
size: Word;
index: Word
end;
FILE* = record end;
StringBuffer* = record
@ -103,28 +103,28 @@ type
SourceCode = record
position: Position;
input: Pointer;
empty: proc(Pointer) -> Bool;
advance: proc(Pointer);
head: proc(Pointer) -> Char
input: Pointer;
empty: proc(Pointer) -> Bool;
advance: proc(Pointer);
head: proc(Pointer) -> Char
end;
Token* = record
kind: TokenKind;
value: union
int_value: Int;
string: String;
boolean_value: Bool;
char_value: Char
boolean_value: Bool;
char_value: Char
end;
location: Location
location: Location
end;
CommandLine* = record
input: ^Char;
lex: Bool;
parse: Bool
lex: Bool;
parse: Bool
end;
Lexer* = record
length: Word;
length: Word;
data: ^Token
end;
@ -314,7 +314,7 @@ begin
if source_file^.index > source_file^.size then
source_file^.size := fread(cast(@source_file^.buffer: Pointer), 1u, 1024u, source_file^.handle);
source_file^.index := 1u
source_file^.index := 1u
end;
return source_file^.size = 0u