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 Request) Enable the use of shebangs #2

Open
eliminmax opened this issue Jun 29, 2023 · 2 comments
Open

(Feature Request) Enable the use of shebangs #2

eliminmax opened this issue Jun 29, 2023 · 2 comments

Comments

@eliminmax
Copy link

On Unix and Unix-like systems (such as macOS and Linux), beginning a script with #! followed by a path to an interpreter and arguments tells the system to use that interpreter to run the script - that's why, as an example, many python programs start with the line #!/usr/bin/env python.

The simplest way to implement this is to allow comments to start with # in addition to //.

I was able to get this working with only minor additions to src/lexer.rs - pull request will follow shortly.

@RocketRace
Copy link
Owner

RocketRace commented Jun 30, 2023

I see there's two plausible solutions to this:

  • Your idea which is to allow #-based comments
    • It's a language change, so it would be nice to document on the esolangs page, possibly as an optional feature
  • Some command-line flag (like -x) that skips the first line of the source file
    • Mutually exclusive with -c
    • Not a language change, but this is the de facto implementation anyways so that doesn't actually matter that much.

Either is acceptable for me, but I don't use shebangs often enough to have a perspective on what's preferable so I'd like some opinions.

Now I admit I haven't looked at this codebase for a long time. Since this was my first real Rust project, I also apologize for you having to skim through it 😆

@eliminmax
Copy link
Author

I think that a command-line option would be a good idea, and some languages do it. That said, I don't know how you'd implement it in this codebase, but I might give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants