Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add support for compiler-behaviour-modifying pragma comments #480

Open
2 of 5 tasks
Luna-Klatzer opened this issue Jul 10, 2023 · 0 comments
Open
2 of 5 tasks
Assignees
Labels
feature New feature or enhancement
Milestone

Comments

@Luna-Klatzer
Copy link
Member

Is there an existing proposal for this?

  • I have searched the existing issues

This feature does not exist in the latest version

  • I am using the latest version

Proposal

Like many other language compilers, the Kipper compiler provides various config options, which can be enabled or disabled to modify the behaviour of the compiler. These configuration options are project/file-spanning though, meaning if something has been turned off it will be turned off everywhere.

As such it would be a good to add the ability to specify statement-specific compiler behaviour using a #pragma comment, where the next statements following the comment will have the specific configuration/behaviour applied.

For example:

#pragma no-optimisations
var x: num = 15 * 15 * 15; // -> Would not be optimised down to a constant number

Although the syntax #pragma can also be replaced by something else, like for example:

  • #kip no-optimisations
    
  • // @kip-no-optimisations
    

Exact behaviour / changes you want

  • Implement a special type of comment, which is recognised by the compiler and associated with a specific statement following it.
  • Add support for multiple different config options, like for example no-optimisations.
  • Add support for custom pragma recognisers, which can hook into the compiler and add custom behaviour.
@Luna-Klatzer Luna-Klatzer added the feature New feature or enhancement label Jul 10, 2023
@Luna-Klatzer Luna-Klatzer self-assigned this Jul 10, 2023
@Luna-Klatzer Luna-Klatzer added this to the v0.13.0 milestone Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or enhancement
Projects
Status: Under Consideration
Development

No branches or pull requests

1 participant