How to encode FIRST & FOLLOW sets inside a compiler
问题 I am writing a compiler for a compiler design course that I am taking and I am currently at the Syntax Analysis where I need to write a parser. I need to have the FIRST and FOLLOW sets to handle any errors that may appear in the source text. I have precalculated the FIRST and FOLLOW sets for all of the non-terminals in my grammar but I am having trouble deciding where I should actually encode them inside of my program. Should I place them in a map where the key is the name of the non-terminal