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

Top level characters are not supported #47

Open
laurenthuberdeau opened this issue Jun 23, 2024 · 0 comments
Open

Top level characters are not supported #47

laurenthuberdeau opened this issue Jun 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@laurenthuberdeau
Copy link
Collaborator

Context

The following program crashes when compiled by pnut-sh. This is because the corresponding character ident is not yet defined. There are a few options to solve this:

  1. Generate all globals at the end, after the runtime library and character literal constants. This changes the structure of the code and globals are often declared beside functions using them so we probably don't want that.
  2. Generate the character literal constant before defining the global variable. This means character constants can be defined in many places and doesn't look nice.
  3. Use the numeric value instead of the character literal constant. Maybe add a comment beside it indicating what the ascii code correspond to.
char chr = 'a';

void main() {
  return;
}
@laurenthuberdeau laurenthuberdeau added the bug Something isn't working label Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant