Type check the return statement

This commit is contained in:
2025-03-25 11:29:29 +01:00
parent c022805c53
commit d359056354
13 changed files with 483 additions and 477 deletions

View File

@ -1,110 +1,110 @@
const
SEEK_SET* = 0
SEEK_CUR* = 1
SEEK_END* = 2
SEEK_SET* = 0;
SEEK_CUR* = 1;
SEEK_END* = 2;
TOKEN_IDENTIFIER* = 1
TOKEN_IF* = 2
TOKEN_THEN* = 3
TOKEN_ELSE* = 4
TOKEN_ELSIF* = 5
TOKEN_WHILE* = 6
TOKEN_DO* = 7
TOKEN_PROC* = 8
TOKEN_BEGIN* = 9
TOKEN_END* = 10
TOKEN_EXTERN* = 11
TOKEN_CONST* = 12
TOKEN_VAR* = 13
TOKEN_ARRAY* = 14
TOKEN_OF* = 15
TOKEN_TYPE* = 16
TOKEN_RECORD* = 17
TOKEN_UNION* = 18
TOKEN_POINTER* = 19
TOKEN_TO* = 20
TOKEN_BOOLEAN* = 21
TOKEN_NIL* = 22
TOKEN_AND* = 23
TOKEN_OR* = 24
TOKEN_NOT* = 25
TOKEN_RETURN* = 26
TOKEN_CAST* = 27
TOKEN_SHIFT_LEFT* = 28
TOKEN_SHIFT_RIGHT* = 29
TOKEN_LEFT_PAREN* = 30
TOKEN_RIGHT_PAREN* = 31
TOKEN_LEFT_SQUARE* = 32
TOKEN_RIGHT_SQUARE* = 33
TOKEN_GREATER_EQUAL* = 34
TOKEN_LESS_EQUAL* = 35
TOKEN_GREATER_THAN* = 36
TOKEN_LESS_THAN* = 37
TOKEN_NOT_EQUAL* = 38
TOKEN_EQUAL* = 39
TOKEN_SEMICOLON* = 40
TOKEN_DOT* = 41
TOKEN_COMMA* = 42
TOKEN_PLUS* = 43
TOKEN_MINUS* = 44
TOKEN_MULTIPLICATION* = 45
TOKEN_DIVISION* = 46
TOKEN_REMAINDER* = 47
TOKEN_ASSIGNMENT* = 48
TOKEN_COLON* = 49
TOKEN_HAT* = 50
TOKEN_AT* = 51
TOKEN_COMMENT* = 52
TOKEN_INTEGER* = 53
TOKEN_WORD* = 54
TOKEN_CHARACTER* = 55
TOKEN_STRING* = 56
TOKEN_DEFER* = 57
TOKEN_EXCLAMATION* = 58
TOKEN_ARROW = 59
TOKEN_IDENTIFIER* = 1;
TOKEN_IF* = 2;
TOKEN_THEN* = 3;
TOKEN_ELSE* = 4;
TOKEN_ELSIF* = 5;
TOKEN_WHILE* = 6;
TOKEN_DO* = 7;
TOKEN_PROC* = 8;
TOKEN_BEGIN* = 9;
TOKEN_END* = 10;
TOKEN_EXTERN* = 11;
TOKEN_CONST* = 12;
TOKEN_VAR* = 13;
TOKEN_ARRAY* = 14;
TOKEN_OF* = 15;
TOKEN_TYPE* = 16;
TOKEN_RECORD* = 17;
TOKEN_UNION* = 18;
TOKEN_POINTER* = 19;
TOKEN_TO* = 20;
TOKEN_BOOLEAN* = 21;
TOKEN_NIL* = 22;
TOKEN_AND* = 23;
TOKEN_OR* = 24;
TOKEN_NOT* = 25;
TOKEN_RETURN* = 26;
TOKEN_CAST* = 27;
TOKEN_SHIFT_LEFT* = 28;
TOKEN_SHIFT_RIGHT* = 29;
TOKEN_LEFT_PAREN* = 30;
TOKEN_RIGHT_PAREN* = 31;
TOKEN_LEFT_SQUARE* = 32;
TOKEN_RIGHT_SQUARE* = 33;
TOKEN_GREATER_EQUAL* = 34;
TOKEN_LESS_EQUAL* = 35;
TOKEN_GREATER_THAN* = 36;
TOKEN_LESS_THAN* = 37;
TOKEN_NOT_EQUAL* = 38;
TOKEN_EQUAL* = 39;
TOKEN_SEMICOLON* = 40;
TOKEN_DOT* = 41;
TOKEN_COMMA* = 42;
TOKEN_PLUS* = 43;
TOKEN_MINUS* = 44;
TOKEN_MULTIPLICATION* = 45;
TOKEN_DIVISION* = 46;
TOKEN_REMAINDER* = 47;
TOKEN_ASSIGNMENT* = 48;
TOKEN_COLON* = 49;
TOKEN_HAT* = 50;
TOKEN_AT* = 51;
TOKEN_COMMENT* = 52;
TOKEN_INTEGER* = 53;
TOKEN_WORD* = 54;
TOKEN_CHARACTER* = 55;
TOKEN_STRING* = 56;
TOKEN_DEFER* = 57;
TOKEN_EXCLAMATION* = 58;
TOKEN_ARROW = 59;
type
Position* = record
line: Word
line: Word;
column: Word
end
Location* = record
first: Position
first: Position;
last: Position
end
SourceFile* = record
buffer: [1024]Char
handle: ^FILE
size: Word
buffer: [1024]Char;
handle: ^FILE;
size: Word;
index: Word
end
FILE* = record end
StringBuffer* = record
data: ^Byte
size: Word
data: ^Byte;
size: Word;
capacity: Word
end
SourceCode = record
position: Position
position: Position;
input: ^Byte
empty: proc(^Byte) -> Bool
advance: proc(^Byte)
input: ^Byte;
empty: proc(^Byte) -> Bool;
advance: proc(^Byte);
head: proc(^Byte) -> Char
end
Token* = record
kind: Int
kind: Int;
value: union
int_value: Int
string: String
boolean_value: Bool
int_value: Int;
string: String;
boolean_value: Bool;
char_value: Char
end
end;
location: Location
end
CommandLine* = record
input: ^Char
tokenize: Bool
input: ^Char;
tokenize: Bool;
syntax_tree: Bool
end
@ -985,5 +985,5 @@ begin
end
begin
exit(process(cast(count: Int), cast(parameters: ^^Char)))
exit(process(count, parameters))
end.