Skip to content

Commit bed4a76

Browse files
authored
Merge pull request #714 from yui-knk/update_news
Update NEWS for v0.7.1
2 parents 78049a5 + ae66c02 commit bed4a76

File tree

1 file changed

+309
-1
lines changed

1 file changed

+309
-1
lines changed

NEWS.md

Lines changed: 309 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,308 @@
11
# NEWS for Lrama
22

3-
## Lrama 0.7.1 (2025-xx-xx)
3+
## Lrama 0.7.1 (2025-12-24)
4+
5+
### Optimize IELR
6+
7+
Optimized performance to a level that allows for IELR testing in practical applications.
8+
9+
https://github.com/ruby/lrama/pull/595
10+
https://github.com/ruby/lrama/pull/605
11+
https://github.com/ruby/lrama/pull/685
12+
https://github.com/ruby/lrama/pull/700
13+
14+
### Introduce counterexamples timeout
15+
16+
Counterexample searches can sometimes take a long time, so we've added a timeout to abort the process after a set period. The current limits are:
17+
18+
* 10 seconds per case
19+
* 120 seconds total (cumulative)
20+
21+
Please note that these are hard-coded and cannot be modified by the user in the current version.
22+
23+
https://github.com/ruby/lrama/pull/623
24+
25+
### Optimize Counterexamples
26+
27+
Optimized counterexample search performance.
28+
29+
https://github.com/ruby/lrama/pull/607
30+
https://github.com/ruby/lrama/pull/610
31+
https://github.com/ruby/lrama/pull/614
32+
https://github.com/ruby/lrama/pull/622
33+
https://github.com/ruby/lrama/pull/627
34+
https://github.com/ruby/lrama/pull/629
35+
https://github.com/ruby/lrama/pull/659
36+
37+
### Support parameterized rule's arguments include inline
38+
39+
Allow to use %inline directive with Parameterized rules arguments. When an inline rule is used as an argument to a Parameterized rule, it expands inline at the point of use.
40+
41+
```yacc
42+
%rule %inline op : '+'
43+
| '-'
44+
;
45+
%%
46+
operation : op?
47+
;
48+
```
49+
50+
This expands to:
51+
52+
```yacc
53+
operation : /* empty */
54+
| '+'
55+
| '-'
56+
;
57+
```
58+
59+
https://github.com/ruby/lrama/pull/637
60+
61+
### Render conflicts of each state on output file
62+
63+
Added token information for conflicts in the output file.
64+
These information are useful when a state has many actions.
65+
66+
```
67+
State 1
68+
69+
4 class: keyword_class • tSTRING "end"
70+
5 $@1: ε • [tSTRING]
71+
7 class: keyword_class • $@1 tSTRING '!' "end" $@2
72+
8 $@3: ε • [tSTRING]
73+
10 class: keyword_class • $@3 tSTRING '?' "end" $@4
74+
75+
Conflict on tSTRING. shift/reduce($@1)
76+
Conflict on tSTRING. shift/reduce($@3)
77+
Conflict on tSTRING. reduce($@1)/reduce($@3)
78+
79+
tSTRING shift, and go to state 6
80+
81+
tSTRING reduce using rule 5 ($@1)
82+
tSTRING reduce using rule 8 ($@3)
83+
84+
$@1 go to state 7
85+
$@3 go to state 8
86+
```
87+
88+
https://github.com/ruby/lrama/pull/541
89+
90+
### Render the origin of conflicted tokens on output file
91+
92+
For example, for the grammar file like below:
93+
94+
```
95+
%%
96+
97+
program: expr
98+
;
99+
100+
expr: expr '+' expr
101+
| tNUMBER
102+
;
103+
104+
%%
105+
```
106+
107+
Lrama generates output file which describes where `"plus"` (`'+'`) look ahead tokens come from:
108+
109+
```
110+
State 6
111+
112+
2 expr: expr • "plus" expr
113+
2 | expr "plus" expr • ["end of file", "plus"]
114+
115+
Conflict on "plus". shift/reduce(expr)
116+
"plus" comes from state 0 goto by expr
117+
"plus" comes from state 5 goto by expr
118+
```
119+
120+
state 0 and state 5 look like below:
121+
122+
```
123+
State 0
124+
125+
0 $accept: • program "end of file"
126+
1 program: • expr
127+
2 expr: • expr "plus" expr
128+
3 | • tNUMBER
129+
130+
tNUMBER shift, and go to state 1
131+
132+
program go to state 2
133+
expr go to state 3
134+
135+
State 5
136+
137+
2 expr: • expr "plus" expr
138+
2 | expr "plus" • expr
139+
3 | • tNUMBER
140+
141+
tNUMBER shift, and go to state 1
142+
143+
expr go to state 6
144+
```
145+
146+
https://github.com/ruby/lrama/pull/726
147+
148+
### Render precedences usage information on output file
149+
150+
For example, for the grammar file like below:
151+
152+
```
153+
%left tPLUS
154+
%right tUPLUS
155+
156+
%%
157+
158+
program: expr ;
159+
160+
expr: tUPLUS expr
161+
| expr tPLUS expr
162+
| tNUMBER
163+
;
164+
165+
%%
166+
```
167+
168+
Lrama generates output file which describes where these precedences are used to resolve conflicts:
169+
170+
```
171+
Precedences
172+
precedence on "unary+" is used to resolve conflict on
173+
LALR
174+
state 5. Conflict between reduce by "expr -> tUPLUS expr" and shift "+" resolved as reduce ("+" < "unary+").
175+
precedence on "+" is used to resolve conflict on
176+
LALR
177+
state 5. Conflict between reduce by "expr -> tUPLUS expr" and shift "+" resolved as reduce ("+" < "unary+").
178+
state 8. Conflict between reduce by "expr -> expr tPLUS expr" and shift "+" resolved as reduce (%left "+").
179+
```
180+
181+
https://github.com/ruby/lrama/pull/741
182+
183+
### Add support for reporting Rule Usage Frequency
184+
185+
Support to report rule usage frequency statistics for analyzing grammar characteristics.
186+
Run `exe/lrama --report=rules` to show how frequently each terminal and non-terminal symbol is used in the grammar rules.
187+
188+
```console
189+
$ exe/lrama --report=rules sample/calc.y
190+
Rule Usage Frequency
191+
0 tSTRING (4 times)
192+
1 keyword_class (3 times)
193+
2 keyword_end (3 times)
194+
3 '+' (2 times)
195+
4 string (2 times)
196+
5 string_1 (2 times)
197+
6 '!' (1 times)
198+
7 '-' (1 times)
199+
8 '?' (1 times)
200+
9 EOI (1 times)
201+
10 class (1 times)
202+
11 program (1 times)
203+
12 string_2 (1 times)
204+
13 strings_1 (1 times)
205+
14 strings_2 (1 times)
206+
15 tNUMBER (1 times)
207+
```
208+
209+
This feature provides insights into the language characteristics by showing:
210+
- Which symbols are most frequently used in the grammar
211+
- The distribution of terminal and non-terminal usage
212+
- Potential areas for grammar optimization or refactoring
213+
214+
The frequency statistics help developers understand the grammar structure and can be useful for:
215+
- Grammar complexity analysis
216+
- Performance optimization hints
217+
- Language design decisions
218+
- Documentation and educational purposes
219+
220+
https://github.com/ruby/lrama/pull/677
221+
222+
### Render Split States information on output file
223+
224+
For example, for the grammar file like below:
225+
226+
```
227+
%token a
228+
%token b
229+
%token c
230+
%define lr.type ielr
231+
232+
%precedence tLOWEST
233+
%precedence a
234+
%precedence tHIGHEST
235+
236+
%%
237+
238+
S: a A B a
239+
| b A B b
240+
;
241+
242+
A: a C D E
243+
;
244+
245+
B: c
246+
| // empty
247+
;
248+
249+
C: D
250+
;
251+
252+
D: a
253+
;
254+
255+
E: a
256+
| %prec tHIGHEST // empty
257+
;
258+
259+
%%
260+
```
261+
262+
Lrama generates output file which describes where which new states are created when IELR is enabled:
263+
264+
```
265+
Split States
266+
267+
State 19 is split from state 4
268+
State 20 is split from state 9
269+
State 21 is split from state 14
270+
```
271+
272+
https://github.com/ruby/lrama/pull/624
273+
274+
### Add ioption support to the Standard library
275+
276+
Support `ioption` (inline option) rule, which is expanded inline without creating intermediate rules.
277+
278+
Unlike the regular `option` rule that generates a separate rule, `ioption` directly expands at the point of use:
279+
280+
```yacc
281+
program: ioption(number) expr
282+
283+
// Expanded inline to:
284+
285+
program: expr
286+
| number expr
287+
```
288+
289+
This differs from the regular `option` which would generate:
290+
291+
```yacc
292+
program: option(number) expr
293+
294+
// Expanded to:
295+
296+
program: option_number expr
297+
option_number: %empty
298+
| number
299+
```
300+
301+
The `ioption` rule provides more compact grammar generation by avoiding intermediate rule creation, which can be beneficial for reducing the parser's rule count and potentially improving performance.
302+
303+
This feature is inspired by Menhir's standard library and maintains compatibility with [Menhir's `ioption` behavior](https://github.com/let-def/menhir/blob/e8ba7bef219acd355798072c42abbd11335ecf09/src/standard.mly#L33-L41).
304+
305+
https://github.com/ruby/lrama/pull/666
4306

5307
### Syntax Diagrams
6308

@@ -14,6 +316,8 @@ If you use syntax diagrams, you add `--diagram` option.
14316
$ exe/lrama --diagram sample.y
15317
```
16318

319+
https://github.com/ruby/lrama/pull/523
320+
17321
### Support `--profile` option
18322

19323
You can profile parser generation process without modification for Lrama source code.
@@ -27,6 +331,10 @@ Then "tmp/stackprof-cpu-myapp.dump" is generated.
27331

28332
https://github.com/ruby/lrama/pull/525
29333

334+
### Add support Start-Symbol: `%start`
335+
336+
https://github.com/ruby/lrama/pull/576
337+
30338
## Lrama 0.7.0 (2025-01-21)
31339

32340
### [EXPERIMENTAL] Support the generation of the IELR(1) parser described in this paper

0 commit comments

Comments
 (0)