This looks to me very similar to a language grammar. It looks good to me. I assume that epsilon is the terminated value.
OK, from this site http://web.cs.wpi.edu/~kal/PLT/PLT4.1.2.html describing how to eliminate left recursion.
For each rule which contains a left-recursive option,
A --> A alpha | beta
introduce a new nonterminal A' and rewrite the rule as
A --> beta A'
A' --> epsilon | alpha A'
So apply the same way to your problem...
id-seq -> id-seq | id
id-seq -> id , id-seq'
id-seq' -> epsilon | id-seq'
Does that make sense to you?
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17
It is not a left recursion because...
id-seq -> id | id-seq, id
has no terminated value, but
id-seq' -> id-seq' | epsilon
has a terminated value which guarantees that the recursion will end eventually. :) That's why the epsilon is there.
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17