I am writing a lexical analyzer for a fictional language in java. I have a for loop which prints out the type and the tokens read. The thing is it prints one character at a time and there is a reserved word 'print'. I am having trouble with making it recognize that it is a reserved word and not just a normal one (Identifier).
Here is my loop:
Thx in advance for any help.private static void readLetters(int i) { for (int j=0;j<36;j++) { if (shitarray[i]==letters[j]) { String abc ="" +shitarray[i]; d=abc; if (c != "Identifier ") { c = "Identifier "; System.out.print(c); System.out.print(abc); } else { c = "Identifier "; System.out.print(abc); } } } }