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 shebangs that can be used to invoke the Kipper CLI or any interpreter in the transpiled form #436

Open
2 tasks done
Luna-Klatzer opened this issue Mar 26, 2023 · 0 comments
Assignees
Labels
feature New feature or enhancement

Comments

@Luna-Klatzer
Copy link
Member

Luna-Klatzer commented Mar 26, 2023

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

Add support for shebangs which should allow an easier invocation of the Kipper CLI run command or a different interpreter in the compiled form. These should reference an executable interpreter which will process the given file.

Potential shebang usages (On Linux - MacOS excluded for now):

  • Easier invocation of the Kipper CLI:
    #!/usr/bin/env kipper run [other args...]
    print("Hello world!");
    
  • Easier invocation for node or ts-node in the transpiled output form (The Kipper compiler will preserve the shebang unless explicitly told not to):
    #!/usr/bin/env node [other args...]
    print("Hello world!");
    
    Transpiled:
    #!/usr/bin/env node [other args...]
    ...
    __kipper.print("Hello world!");
    

Additionally, besides the shebang itself, there should be a compilation argument --preserve-shebang which should tell the compiler whether to remove or keep the shebang in the output code.

Exact behaviour / changes you want

  • Implement compiler support for parsing and interpreting shebangs.
  • Add argument --preserve-shebang to the CLI and the compiler API, which tells the compiler whether to preserve the shebang or not.
  • Ensure the Kipper CLI works with the shebang style as shown above in the proposal section.
@Luna-Klatzer Luna-Klatzer added the feature New feature or enhancement label Mar 26, 2023
@Luna-Klatzer Luna-Klatzer self-assigned this Mar 26, 2023
@Luna-Klatzer Luna-Klatzer pinned this issue Jun 21, 2023
@Luna-Klatzer Luna-Klatzer unpinned this issue Jun 25, 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