Re: Can ANTLR check for valid variable declarations?
Saturday, February 2, 2002 09:55 AM
ANTLR is tool that generates parser from a grammatical description of your input language. You can give it a grammar to read in that input, but you will have to add actions to check for valid declarations etc... For example, you will add "m" to your symbol table when you see it in "int m=0;" and then check symbol table when you see "m = i;" Oh, actually in your case, you're looking for trouble with 'i'. It would not be found in the table so it would be an error.