Skip to content

Conversation

@MammarDr
Copy link

@MammarDr MammarDr commented Dec 20, 2025

Issue #138
Hi this is my first github contribution and i feel honored to be help to you as you were to me in your amazing courses.

1-
I fixed the wrong generated first sets from productions that have the nullable LHS(derive ε) appear in firstOf(rhs).

Grammar:
B -> B "a" | ε

Without fix:
First(B) = { ε }

With fix:
First(B) = { "a", ε }

the solution is to register the Non-Terminals that derive epsilon directly (A->ε) before calculating the first sets.

added test case for this issue.

2-
i also spotted a function typo 'getOrignialSymbol' -> 'getOriginalSymbol'

@MammarDr MammarDr changed the title Fix Issue #138 Fixing First Set Generator Dec 22, 2025
@MammarDr MammarDr changed the title Fixing First Set Generator Fixing Wrong Generated First Set Dec 22, 2025
Copy link
Owner

@DmitrySoshnikov DmitrySoshnikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MammarDr, thanks for the contribution - glad we have this bug finally caught! Please see comments on the formatting (use tools which should be in this repo for auto-format the code to single style).

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