441d0122f8
Merge pull request 'feature/add-enum-support' ( #1 ) from feature/add-enum-support into master
...
Reviewed-on: #1
2023-03-20 21:19:53 +01:00
e835bd0f06
GenASM: Make GenASM quietly rewrite a user's function if it's called main.
...
We generate our own main function that executes the user's specified expression at the end of his file. This auto generated function has to be called "main" in order for it to be executed on startup. If the user chooses to call one of his own functions "main" our auto generated function would collide with the user's function. That's why we quietly rewrite the user's function to "main_by_user". This way we prevent a collision.
Note for the future: We should change our Syntax to allow for no expression as the last definition of a file. This way the user can choose if a particular source file needs to contain a main function or not (just like c does it). This is also one of the requirements for modules to work.
2023-03-20 21:05:24 +01:00
ea1c04ae0a
Build: Add a main manifest attribute to the generated jar.
...
This makes it possible to directly execute the packaged jar.
2023-03-20 19:55:37 +01:00
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
77fe360ffa
Evaluate: Implement evaluation for enums.
2023-03-20 19:10:40 +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
22634c9652
Use LinkedHashMaps and LinkedHashSets to preserve the order of parameters and struct fields.
2023-03-15 23:08:38 +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
7c40a50196
add intellij config files
2023-03-15 05:23:09 +01:00
Dennis Kaiser
8529e24a37
Merge branch '32-create-asm-class-structure' into 'master'
...
32: Create Meta ASM Structure
Closes #32
See merge request mkais001/klang!23
2020-03-17 16:08:54 +01:00
Marvin Kaiser
49b024b95f
32: Require data type for all asm functions
2020-03-17 16:02:03 +01:00
Marvin Kaiser
982fc6417d
32: Create Meta ASM Structure
2020-03-14 14:14:19 +01:00
Dennis Kaiser
bd173b1d45
Merge branch 'bug/fix-tco' into 'master'
...
push all args onto stack before moving them into the local var to ensure that...
See merge request mkais001/klang!22
abgabe_compilerbau
2020-03-10 12:19:34 +01:00
221b928d0e
push all args onto stack before moving them into the local var to ensure that the function parameters can be used in the tail recursive function call
2020-03-10 12:07:55 +01:00
Marvin Kaiser
8dd0b6cffa
Fix pretty printing to file
2020-03-10 11:21:49 +01:00
Marvin Kaiser
f288d5585f
Update README.md
2020-03-10 11:04:03 +01:00
Dennis Kaiser
e05ca07d23
Merge branch 'extend-readme' into 'master'
...
add section explaining structs
See merge request mkais001/klang!21
2020-03-09 23:27:45 +01:00
fd17a25f29
add section explaining structs
2020-03-09 23:18:46 +01:00
Dennis Kaiser
500cfaffbe
Merge branch 'fix-do-while' into 'master'
...
visit block first because the condition variable may be initialized inside the block
See merge request mkais001/klang!20
2020-03-09 23:16:33 +01:00
5a5191612e
visit block first because the condition variable may be initialized inside the block
2020-03-09 23:04:55 +01:00
Dennis Kaiser
36a38ee7ab
Merge branch '16-tail-recursion-optimization' into 'master'
...
Resolve "Tail Recursion Optimization"
Closes #16
See merge request mkais001/klang!18
2020-03-09 22:59:38 +01:00
Dennis Kaiser
c38a330fda
Merge branch '19-add-junit-testsuite' into 'master'
...
Resolve "Add JUnit Testsuite"
Closes #19
See merge request mkais001/klang!19
2020-03-09 22:59:24 +01:00
ac870460e6
use ubuntu, install maven
2020-03-09 22:03:01 +01:00
da56e1c05e
try maven:latest as base image
2020-03-09 21:55:47 +01:00
ba17c7e2b6
fix typo
2020-03-09 21:50:06 +01:00
d6c0131d8f
add test parser test, rename test to test compilation
2020-03-09 21:46:52 +01:00
d90581f0cd
add new target testJava to execute the junit tests
2020-03-09 21:46:31 +01:00
6714d2136d
do not run tests when building the project
2020-03-09 21:43:26 +01:00
fe9c9b79b8
add test directory to settings
2020-03-09 21:40:45 +01:00
89ec828499
remove unused import
2020-03-09 21:32:40 +01:00
9df0da89ff
implement junit tests
2020-03-09 21:32:05 +01:00
649e690ac4
add junit
2020-03-09 21:31:54 +01:00
6d60dcc4a3
add option to surpress illegal relfective access warning
2020-03-09 21:31:45 +01:00
35de3c7de4
implement test for tail call optimization
2020-03-09 17:10:50 +01:00
5701d3e918
add TCO to readme, add floats
2020-03-09 16:13:44 +01:00
704e6441ca
move float result into rax before further processing
2020-03-09 16:09:15 +01:00
cb5ceafbbc
implement tail recursion call optimization when generation function call
2020-03-09 15:58:15 +01:00
d96b083c41
add metadata to class fields during visit of function definition nodes
2020-03-09 15:57:37 +01:00
acaa37b3b1
implement detection of tail calls
2020-03-09 15:55:23 +01:00
d1cf626934
add flag to indicate whether this is a tail call
2020-03-09 15:55:01 +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
Dennis Kaiser
335b70d301
Merge branch '29-remove-print-statement' into 'master'
...
delete print statement
Closes #29
See merge request mkais001/klang!16
2020-03-09 14:23:07 +01:00