diff options
author | yui-knk <spiketeika@gmail.com> | 2024-02-14 21:55:30 +0900 |
---|---|---|
committer | Yuichiro Kaneko <spiketeika@gmail.com> | 2024-02-15 07:44:30 +0900 |
commit | 06ad00adc2505142cc06ec291c18a90dd01baa80 (patch) | |
tree | a5b337bce9a5c39dc0037f306b8329ce5c541d14 /tool/lrama/NEWS.md | |
parent | 95ec71efc502e93c136ac26a497c6498791e6ba6 (diff) |
Lrama v0.6.3
Diffstat (limited to 'tool/lrama/NEWS.md')
-rw-r--r-- | tool/lrama/NEWS.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tool/lrama/NEWS.md b/tool/lrama/NEWS.md index 122443261f..b5c26408de 100644 --- a/tool/lrama/NEWS.md +++ b/tool/lrama/NEWS.md @@ -1,5 +1,39 @@ # NEWS for Lrama +## Lrama 0.6.3 (2024-02-15) + +### Bring Your Own Stack + +Provide functionalities for Bring Your Own Stack. + +Ruby’s Ripper library requires their own semantic value stack to manage Ruby Objects returned by user defined callback method. Currently Ripper uses semantic value stack (`yyvsa`) which is used by parser to manage Node. This hack introduces some limitation on Ripper. For example, Ripper can not execute semantic analysis depending on Node structure. + +Lrama introduces two features to support another semantic value stack by parser generator users. + +1. Callback entry points + +User can emulate semantic value stack by these callbacks. +Lrama provides these five callbacks. Registered functions are called when each event happen. For example %after-shift function is called when shift happens on original semantic value stack. + +* `%after-shift` function_name +* `%before-reduce` function_name +* `%after-reduce` function_name +* `%after-shift-error-token` function_name +* `%after-pop-stack` function_name + +2. `$:n` variable to access index of each grammar symbols + +User also needs to access semantic value of their stack in grammar action. `$:n` provides the way to access to it. `$:n` is translated to the minus index from the top of the stack. +For example + +``` +primary: k_if expr_value then compstmt if_tail k_end + { + /*% ripper: if!($:2, $:4, $:5) %*/ + /* $:2 = -5, $:4 = -3, $:5 = -2. */ + } +``` + ## Lrama 0.6.2 (2024-01-27) ### %no-stdlib directive |