198bd74a47
Enums: Make the EnumAccessExpression save a reference to the EnumValue it is referencing.
...
This can be used during assembler generation to easily find the correct EnumValue for a given EnumAccessExpression.
2023-03-20 19:54:48 +01:00
0594542167
Enums: Make EnumDefinition use EnumValues instead of Strings as children.
...
This allows us to store the index of the enum value along the name. The index can be used to compare two enum values in assembler.
Later on this might be used to enable users of KLang to set arbitrary values as the index of an enum value.
2023-03-20 19:30:07 +01:00
55a5b8f54a
Make sure that a variable that references an enum has to be initialized.
2023-03-16 00:01:31 +01:00
2768b4429c
Check that a struct field name of a struct declaration does not shadow an enum or a struct definition.
2023-03-15 23:48:57 +01:00
30dfbbbbba
Check that a variable name of variable declaration does not shadow an enum definition.
2023-03-15 23:33:12 +01:00
f77d6a002d
Check that a parameter name of a function definition does not shadow an enum definition.
2023-03-15 23:17:43 +01:00
6fd3f5a2e6
Make it possible to use an enum in an expression (i.e. selecting one of the enum values: Foo.A)
2023-03-15 19:14:04 +01:00
3b928d621b
Refactor FunctionDefinition and Parameter context analysis and extend the type check to include enums.
2023-03-15 17:47:58 +01:00
9a58afb550
Implement StructField type checking in ContextAnalysis.
2023-03-15 17:21:35 +01:00
6e4431652c
Remove FunctionInformation and replace it with FunctionDefinition.
2023-03-15 16:19:42 +01:00
7af815042b
WIP: Add enum support
2023-03-15 15:56:42 +01:00
5a5191612e
visit block first because the condition variable may be initialized inside the block
2020-03-09 23:04:55 +01:00
acaa37b3b1
implement detection of tail calls
2020-03-09 15:55:23 +01:00
Dennis Kaiser
4f1d009626
Merge branch '24-structs' into 'master'
...
Resolve "Structs"
Closes #24
See merge request mkais001/klang!17
2020-03-09 14:43:17 +01:00
ac6cb22e45
delete print statement
2020-03-09 14:19:43 +01:00
e3d8f3cfa7
implement field access visitor
2020-03-09 12:48:31 +01:00
e2986b3d65
add the struct name to the struct field access expression node
2020-03-09 12:48:31 +01:00
86fe676492
rename method to match new grammar
2020-03-09 12:47:02 +01:00
d89c085ecc
implement context analysis for destructor node
2020-03-09 12:47:02 +01:00
80deae6971
implement visitors for null atom
2020-03-09 12:47:02 +01:00
5c0459c5a2
implement constructor call, eval and genasm are still stubs
2020-03-09 12:45:16 +01:00
1ca3f5ca8b
implement context analysis for struct field access expressions
2020-03-09 12:45:16 +01:00
a969aa895f
make GetStructs collect the complete struct definitions
2020-03-09 12:45:16 +01:00
233894fbcf
remove NYI errors, check if a struct is defined if the declared type is not primitive
2020-03-09 12:43:25 +01:00
6981c288e6
implement context analysis
2020-03-09 12:43:25 +01:00
Marvin Kaiser
229920946d
25- Strict check between function signature and function call
2020-03-04 20:53:50 +01:00
Marvin Kaiser
0316a7d4bf
25: Start adding Float Type
2020-03-03 20:45:55 +01:00
a9db8b3f9a
set the initialited field of class VariableDeclaration, make sure a variable has been inizialized prior to its usage
2020-02-04 12:02:41 +01:00
1ae404b978
always add the declared type as the type of a variable declaration. do not use the combined type as the type of the variable that is declared
2020-02-04 11:21:48 +01:00
f3c5bac860
check whether the types of the operants of an equality expression can combine instead of enforcing them to both be integers
2020-02-03 23:45:52 +01:00
e8f80eb2f9
make file pretty
2020-02-03 22:59:17 +01:00
018ce8712a
add error message prefix to type missmatch errors, staticly assign bool type to boolean expressions
2020-02-03 22:56:40 +01:00
6f0a3754bd
check whether the body of a function guarantees a return value and throw an exception if not
2020-02-03 22:36:24 +01:00
02fb7b7cc2
unify error message appearance
2020-02-03 22:28:21 +01:00
cb0d63a71c
save the line and column of the corresponding token, generate an error prefix for every thrown error
2020-02-03 22:20:59 +01:00
Marvin Kaiser
34253a70ba
Implement operator precedence with and without parenthesis
2020-02-03 16:35:29 +01:00
3fb30ebd7e
print statement never has a type
2020-01-27 17:02:21 +01:00
fa8904e0f5
fix type annotation for comparison expressions
2020-01-27 16:57:09 +01:00
Marvin Kaiser
b1be18f367
Fix function type addition for if statement
2020-01-27 16:47:00 +01:00
Marvin Kaiser
db7331911a
Added functionality to analyze AST for all defined functions
2020-01-27 16:04:38 +01:00
0aed4ee893
my initial short for typechecking, still very unifinished tho
2020-01-21 00:21:54 +01:00
722a9babcb
remove unused import
2020-01-20 19:32:16 +01:00
Marvin Kaiser
d27df13ec1
added boolean operators
2020-01-20 16:01:25 +01:00
1186bb4550
add bool literal
2020-01-20 15:26:55 +01:00
Marvin Kaiser
be43cc9a77
implement for loops
2020-01-14 11:04:31 +01:00
Marvin Kaiser
1980e1ba8c
Move the SCOL for var_assigns and var_decl to the statement rule
2020-01-14 10:39:46 +01:00
Marvin Kaiser
586c2bb5d9
renamed whileLoop to WhileLoop
2020-01-14 08:50:45 +01:00
Marvin Kaiser
5eb0679bf3
Renamed doWhileLoop to DoWhileLoop
2020-01-14 08:48:51 +01:00
Marvin Kaiser
e52ad061f9
Implemented do while loops
2020-01-13 16:43:38 +01:00
Marvin Kaiser
bd4ae1d605
Added while loop
2020-01-13 16:08:44 +01:00