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

Add support for west-const #59

Merged
merged 4 commits into from
Jan 18, 2025
Merged

Add support for west-const #59

merged 4 commits into from
Jan 18, 2025

Conversation

gtker
Copy link

@gtker gtker commented Jan 17, 2025

West-const is const int whereas east-const is int const.
They mean the same thing and both can be present at the same time (const int const means the same). The compiler currently only supports east-const.

I updated the test cases as described in #57 (review).

I couldn't get the global int unused = 1; to work (even without const) since knight-native failed with Target label 1 is not valid. It might just be me having an old/incompatible version of the other tools.

Let me know if you would rather have separate tests. I assumed that it would be OK to use existing files since it doesn't change behavior and we only need to check that it parses correctly.

Gtker added 2 commits January 17, 2025 19:39
West-const is `const int` whereas east-const is `int const`.
They mean the same thing and both can be present at the same time
(`const int const` means the same).

This doesn't allow west-const in local/global variables.
West-const is `const int` whereas east-const is `int const`.
They mean the same thing and both can be present at the same time
(`const int const` means the same).

Global variables that are initialized do not seem to work for
knight-native failing with `Target label 1 is not valid` when running
`hex2`.
@gtker
Copy link
Author

gtker commented Jan 17, 2025

Added _Bool type as requested by @stikonas at oriansj/M2libc#67.

Pushed again since I forgot to update the tests.

test/test.answers Outdated Show resolved Hide resolved
As requested in oriansj/M2libc#67.

The standard (C17) says in 6.2.5.2:
```text
An object declared as type _Bool is large enough to store the values 0 and 1
```

It could technically be an int but all major compilers have `sizeof(bool) == 1`.
@stikonas stikonas merged commit 7f9d071 into oriansj:master Jan 18, 2025
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

Successfully merging this pull request may close these issues.

2 participants