-
Notifications
You must be signed in to change notification settings - Fork 29
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
[CN] Allow '
in numeric constants
#337
Comments
Excellent onboarding project.
…On Thu, Jun 20, 2024 at 5:56 AM Iavor S. Diatchki ***@***.***> wrote:
It'd be nice to allow _ in numeric constants, so you can write things
like -2147483648_i32 or 0x_FFFF_FFFF.
If we do this, it would also be nice to update the pretty printers to add
_ before the type suffix of constants (e.g., 0_i32 instead of 0i32).
—
Reply to this email directly, view it on GitHub
<https://urldefense.com/v3/__https://github.com/rems-project/cerberus/issues/337__;!!IBzWLUs!SX3SQiAgba4dS_ZYlX9_UFiWRTmq3rUSlv_Ba4zIRxYeXjbdF23ex0PEBC_s2v7WY_Mbit4h0lRT8x8R75giCHj1SXi6$>,
or unsubscribe
<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABVQQC6WLL7UP7HKG64IGMDZIKRNHAVCNFSM6AAAAABJTTOUS2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGM3DIMBTGE2DGNI__;!!IBzWLUs!SX3SQiAgba4dS_ZYlX9_UFiWRTmq3rUSlv_Ba4zIRxYeXjbdF23ex0PEBC_s2v7WY_Mbit4h0lRT8x8R75giCOq96OYg$>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Unfortunately, to match C23 and C++, the separator must be |
_
in numeric constants'
in numeric constants
'
in numeric constants_
~~ in numeric constants
_
~~ in numeric constants'
in numeric constants
For consistency between the spec and C and code re-use in the lexer (e.g. also handling hex, binary and octal). This feature is being handled in the ongoing C/CN parser split. |
@dc-mak having to write |
|
* This changes the `atomic` boolean parameter to a `prec` integer parameter specifying the precedence of the surrounding context. * We also change how some things are printed: - a lot fewer parens, based on precedence - suffix of numeric literals is separated by `'` (see also #337) - pointers are printed in base 16 - use `NULL` instead of `null` to match CN's input notation - custom printing for negated comparisons `x != y` instead of `!(x == y)` - use `%` instead of `rem` - use `^` instead of `xor_uf` - use `&` instead of `bw_and_uf` - use `|` instead of `bw_or_uf` - use `<<` instead of `shift_left` - use `>>` instead of `shift_right` - use `{ ...s, x = e }` for updating things. This is borrowed from JavaScript but it makes the precedence story simpler. - use `&p->x` instead of `member_shift<T>(p,x)` - use `&p[x]` instead of `array_shift<T>(p,x)` - use `cons(x,xs)` instead of `x :: xs`
* This changes the `atomic` boolean parameter to a `prec` integer parameter specifying the precedence of the surrounding context. * We also change how some things are printed: - a lot fewer parens, based on precedence - suffix of numeric literals is separated by `'` (see also #337) - pointers are printed in base 16 - use `NULL` instead of `null` to match CN's input notation - custom printing for negated comparisons `x != y` instead of `!(x == y)` - use `%` instead of `rem` - use `^` instead of `xor_uf` - use `&` instead of `bw_and_uf` - use `|` instead of `bw_or_uf` - use `<<` instead of `shift_left` - use `>>` instead of `shift_right` - use `{ ...s, x = e }` for updating things. This is borrowed from JavaScript but it makes the precedence story simpler. - use `&p->x` instead of `member_shift<T>(p,x)` - use `&p[x]` instead of `array_shift<T>(p,x)` - use `cons(x,xs)` instead of `x :: xs`
* This changes the `atomic` boolean parameter to a `prec` integer parameter specifying the precedence of the surrounding context. * We also change how some things are printed: - a lot fewer parens, based on precedence - suffix of numeric literals is separated by `'` (see also #337) - pointers are printed in base 16 - use `NULL` instead of `null` to match CN's input notation - custom printing for negated comparisons `x != y` instead of `!(x == y)` - use `%` instead of `rem` - use `^` instead of `xor_uf` - use `&` instead of `bw_and_uf` - use `|` instead of `bw_or_uf` - use `<<` instead of `shift_left` - use `>>` instead of `shift_right` - use `{ ...s, x = e }` for updating things. This is borrowed from JavaScript but it makes the precedence story simpler. - use `&p->x` instead of `member_shift<T>(p,x)` - use `&p[x]` instead of `array_shift<T>(p,x)` - use `cons(x,xs)` instead of `x :: xs`
It'd be nice to allow
_
in numeric constants, so you can write things like-2147483648_i32
or0x_FFFF_FFFF
.If we do this, it would also be nice to update the pretty printers to add
_
before the type suffix of constants (e.g.,0_i32
instead of0i32
).The text was updated successfully, but these errors were encountered: