Skip to content

Add IELR report for state splits and split reasons#790

Open
ydah wants to merge 1 commit intoruby:masterfrom
ydah:ielr-state-splits-report
Open

Add IELR report for state splits and split reasons#790
ydah wants to merge 1 commit intoruby:masterfrom
ydah:ielr-state-splits-report

Conversation

@ydah
Copy link
Copy Markdown
Member

@ydah ydah commented Apr 1, 2026

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 State Splits

    LALR state 4 splits into 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


    LALR state 9 splits into 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


    LALR state 14 splits into 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 from a5077cb to 5854460 Compare April 1, 2026 03:28
@ydah ydah force-pushed the ielr-state-splits-report branch from 5854460 to d44a6eb Compare April 1, 2026 03:32
@junk0612
Copy link
Copy Markdown
Collaborator

junk0612 commented Apr 6, 2026

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.

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