From 10d369d766403b205e62ad6a7dd10c361c90093d Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Fri, 30 Jan 2026 21:59:20 +0100 Subject: [PATCH] Updated grammar, and 0.7.10 first commit --- releasenotes.md | 7 ++++++ resources/grammar/c3.l | 4 ++++ resources/grammar/grammar.y | 45 ++++++++++++++++++------------------- src/version.h | 4 ++-- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/releasenotes.md b/releasenotes.md index ea67c2d0d..110385f16 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,5 +1,12 @@ # C3C Release Notes +## 0.7.10 Change list + +### Changes / improvements + +### Stdlib changes + +### Fixes ## 0.7.9 Change list diff --git a/resources/grammar/c3.l b/resources/grammar/c3.l index 6c3a76c59..83c288e2c 100644 --- a/resources/grammar/c3.l +++ b/resources/grammar/c3.l @@ -96,6 +96,10 @@ typedef struct { "$varef" { return(CT_VAREF); } "$vasplat" { return(CT_VASPLAT); } "$vatype" { return(CT_VATYPE); } +"@pure" { return(AT_PURE); } +"@inline" { return(AT_INLINE); } +"@noinline" { return(AT_NOINLINE); } + "/*" { BEGIN(COMMENT); } { "/*" { yyg->yyextra_r.comment_level++; } diff --git a/resources/grammar/grammar.y b/resources/grammar/grammar.y index 22ce4fcfa..988407ada 100644 --- a/resources/grammar/grammar.y +++ b/resources/grammar/grammar.y @@ -35,7 +35,7 @@ void yyerror(YYLTYPE * yylloc_param , yyscan_t yyscanner, const char *yymsgp); %token CT_SIZEOF CT_STRINGIFY CT_QNAMEOF CT_OFFSETOF CT_VAEXPR CT_FEATURE %token CT_EXTNAMEOF CT_EVAL CT_DEFINED CT_ALIGNOF ASSERT %token ASM CHAR_LITERAL REAL TRUE FALSE CT_CONST_IDENT -%token HASH_CONST_IDENT CT_ASSIGNABLE CT_AND CT_IS_CONST +%token HASH_CONST_IDENT CT_ASSIGNABLE CT_AND CT_IS_CONST AT_INLINE AT_PURE AT_NOINLINE %start translation_unit %% @@ -443,6 +443,11 @@ parameter | CT_IDENT ELLIPSIS ; +opt_call_attributes + : call_inline_attributes + | empty + ; + opt_attributes : attribute_list | empty @@ -623,13 +628,18 @@ range_expr ; call_inline_attributes - : AT_IDENT - | call_inline_attributes AT_IDENT + : call_attribute + | call_inline_attributes call_attribute + ; + +call_attribute + : AT_INLINE + | AT_PURE + | AT_NOINLINE ; call_invocation - : '(' call_arg_list ')' - | '(' call_arg_list ')' call_inline_attributes + : '(' call_arg_list ')' opt_call_attributes ; access_ident @@ -652,6 +662,7 @@ call_trailing | '.' access_ident | INC_OP | DEC_OP + | '~' | '!' | BANGBANG ; @@ -805,31 +816,19 @@ or_stmt_expr | or_stmt_expr CT_OR_OP and_expr ; -suffix_expr - : or_expr - | or_expr '?' - | or_expr '?' '!' - ; - -suffix_stmt_expr - : or_stmt_expr - | or_stmt_expr '?' - | or_stmt_expr '?' '!' - ; - ternary_expr - : suffix_expr + : or_expr | or_expr '?' expr ':' ternary_expr - | suffix_expr ELVIS ternary_expr - | suffix_expr OPTELSE ternary_expr + | or_expr ELVIS ternary_expr + | or_expr OPTELSE ternary_expr | lambda_decl implies_body ; ternary_stmt_expr - : suffix_stmt_expr + : or_stmt_expr | or_stmt_expr '?' expr ':' ternary_expr - | suffix_stmt_expr ELVIS ternary_expr - | suffix_stmt_expr OPTELSE ternary_expr + | or_stmt_expr ELVIS ternary_expr + | or_stmt_expr OPTELSE ternary_expr | lambda_decl implies_body ; diff --git a/src/version.h b/src/version.h index 98e01d9c8..572bad615 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ -#define COMPILER_VERSION "0.7.9" -#define PRERELEASE 0 +#define COMPILER_VERSION "0.7.10" +#define PRERELEASE 1