Skip to content

Add IELR report for state splits and split reasons - #790

Merged
ydah merged 1 commit into
ruby:masterfrom
ydah:ielr-state-splits-report
Nov 21, 2026
Merged

ydah merged 1 commit into
ruby:masterfrom
ydah:ielr-state-splits-report

Conversation

@ydah

@ydah ydah commented Apr 1, 2026 •

Copy link
Copy Markdown
Member

This PR adds a new --report=ielr report that makes IELR state splitting easier to inspect.

The new report shows:

  • which LALR states were split by IELR
  • incoming transitions for each split variant
  • lookahead differences between the split states
  • the reason each split happened, based on dominant actions for each token

Examples

Example output from --report=ielr for spec/fixtures/integration/ielr.y

IELR Isocores

    Isocore of LALR state 4: IELR states 4, 19

      Incoming transitions
        state 1 -- a --> state 4 [LALR core]
        state 2 -- a --> state 19 [IELR split]

      Lookahead differences
        a • C D E  (rule 3)
          state 4 [LALR core]: [a]
          state 19 [IELR split]: []

      Why it split
        token a
          state 4 [LALR core]: reduce using rule 9 (E)
          state 19 [IELR split]: shift and go to state 8


    Isocore of LALR state 9: IELR states 9, 20

      Incoming transitions
        state 4 -- C --> state 9 [LALR core]
        state 19 -- C --> state 20 [IELR split]

      Lookahead differences
        a C • D E  (rule 3)
          state 9 [LALR core]: [a]
          state 20 [IELR split]: []

      Why it split
        token a
          state 9 [LALR core]: reduce using rule 9 (E)
          state 20 [IELR split]: shift and go to state 8


    Isocore of LALR state 14: IELR states 14, 21

      Incoming transitions
        state 9 -- D --> state 14 [LALR core]
        state 20 -- D --> state 21 [IELR split]

      Lookahead differences
        a C D • E  (rule 3)
          state 14 [LALR core]: [a]
          state 21 [IELR split]: []

      Why it split
        token a
          state 14 [LALR core]: reduce using rule 9 (E)
          state 21 [IELR split]: shift and go to state 17

@ydah
ydah force-pushed the ielr-state-splits-report branch 2 times, most recently from 5854460 to d44a6eb Compare April 1, 2026 03:32
@junk0612

junk0612 commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator

The paper uses the technical term "isocore" for a set of states with the same core, and I'd like to use that term in the report as well.

@ydah
ydah force-pushed the ielr-state-splits-report branch 2 times, most recently from 14143c2 to 2b5df5a Compare September 6, 2026 02:26
@ydah
ydah force-pushed the ielr-state-splits-report branch from 2b5df5a to 01a92f6 Compare November 21, 2026 01:35
@ydah
ydah force-pushed the ielr-state-splits-report branch from 01a92f6 to b5d64c0 Compare November 21, 2026 01:41
@ydah
ydah merged commit 70e68ec into ruby:master Nov 21, 2026
23 checks passed
@ydah
ydah deleted the ielr-state-splits-report branch November 21, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants