feature/add-enum-support #1

Merged
nitrix merged 16 commits from feature/add-enum-support into master 2023-03-20 21:19:54 +01:00
Owner
No description provided.
nitrix added 11 commits 2023-03-17 01:04:11 +01:00
nitrix changed title from feature/add-enum-support to WIP:feature/add-enum-support 2023-03-17 01:04:25 +01:00
nitrix added 5 commits 2023-03-20 21:05:52 +01:00
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.
This can be used during assembler generation to easily find the correct EnumValue for a given EnumAccessExpression.
This makes it possible to directly execute the packaged jar.
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.
nitrix changed title from WIP:feature/add-enum-support to feature/add-enum-support 2023-03-20 21:19:30 +01:00
nitrix merged commit 441d0122f8 into master 2023-03-20 21:19:54 +01:00
nitrix deleted branch feature/add-enum-support 2023-03-20 21:19:54 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nitrix/klang#1