Weird Rule Matching

2022-04-06 Thread Tom
Hi, Sorry if this is incorrect place to ask, this is my first time using a mailing list. I have a language that I would like to parse: if N == 2 {     A = 100; } if N == 3 {     B = 123; } To do this I have the relevant rules: program:   statement program     | statement     ; stat

Re: Weird Rule Matching

2022-04-06 Thread Chris verBurg
Tom, I'm thinking this is just the "LA" part of "LALR" parsing. Imagine if you had another rule for "if" that included an "else" clause. The parser would need to know if the token after '}' is an "else" or not, because it changes whether it reduces the if-else rule or the just-if rule. Even tho