From d1bcbbc13620d9d53055742f9ca1220eff821bf3 Mon Sep 17 00:00:00 2001 From: ydah Date: Thu, 27 Jun 2024 00:58:25 +0900 Subject: [PATCH] Add NEWS v0.6.6~v0.6.9 --- NEWS.md | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/NEWS.md b/NEWS.md index 96aaaf94..69b2a268 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,114 @@ # NEWS for Lrama +## Lrama 0.6.9 (2024-05-02) + +### Callee side tag specification of parameterizing rules + +Allow to specify tag on callee side of parameterizing rules. + +``` +%union { + int i; +} + +%rule with_tag(X) : X { $$ = $1; } + ; +``` + +### Named References for actions of RHS in parameterizing rules + +Allow to use named references for actions of RHS in parameterizing rules. + +``` +%rule option(number): /* empty */ + | number { $$ = $number; } + ; +``` + +## Lrama 0.6.8 (2024-04-29) + +### Nested parameterizing rules with tag + +Allow to nested parameterizing rules with tag. + +``` +%union { + int i; +} + +%rule nested_nested_option(X): /* empty */ + | X + ; + +%rule nested_option(X): /* empty */ + | nested_nested_option(X) + ; + +%rule option(Y): /* empty */ + | nested_option(Y) + ; +``` + +## Lrama 0.6.7 (2024-04-28) + +### RHS of user defined parameterizing rules contains `'symbol'?`, `'symbol'+` and `'symbol'*`. + +User can use `'symbol'?`, `'symbol'+` and `'symbol'*` in RHS of user defined parameterizing rules. + +``` +%rule with_word_seps(X): /* empty */ + | X ' '+ + ; +``` + +## Lrama 0.6.6 (2024-04-27) + +### Trace actions + +Support trace actions for debugging. +Run `exe/lrama --trace=actions` to show grammar rules with actions. + +``` +❯ exe/lrama --trace=actions sample/calc.y +Grammar rules with actions: +$accept -> list, YYEOF {} +list -> ε {} +list -> list, LF {} +list -> list, expr, LF { printf("=> %d\n", $2); } +expr -> NUM {} +expr -> expr, '+', expr { $$ = $1 + $3; } +expr -> expr, '-', expr { $$ = $1 - $3; } +expr -> expr, '*', expr { $$ = $1 * $3; } +expr -> expr, '/', expr { $$ = $1 / $3; } +expr -> '(', expr, ')' { $$ = $2; } +``` + +### Inlining + +Support inlining for rules. +The `%inline` directive causes all references to symbols to be replaced with its definition. + +``` +%rule %inline op: PLUS { + } + | TIMES { * } + ; + +%% + +expr : number { $$ = $1; } + | expr op expr { $$ = $1 $2 $3; } + ; +``` + +as same as + +``` +expr : number { $$ = $1; } + | expr '+' expr { $$ = $1 + $3; } + | expr '*' expr { $$ = $1 * $3; } + ; +``` + ## Lrama 0.6.5 (2024-03-25) ### Typed Midrule Actions