Parsing in Java : <p>I have a few, theoretical ideas, but I don't know the language well. We basically need to make a rudimentary lexical analyzer. I have most of the bits, but here's the context. The straight-forward question is at the end.</p>

<p>I need to read in a line from the console, then see if parts match up with a symbol table, which includes the keywords: <code>"print [variable]"</code>, <code>"load [variable]"</code>, <code>"mem [variable]"</code>, <code>"sqrt"</code> and <code>"stop"</code>, as well as mathematical symbols.</p>

<p>It also needs to recognise the variables on their own (such as <code>"c = a + b"</code> as well.)</p>

<p>So...it's not that hard, in theory. You'd check the first character of the string matched up with keywords or variables. If they do, keep looping through that keyword or variable to check if it's the same string, up until you hit a space.</p>

<p>To summarize: How do I check the characters of a read in string to compare to stuff in Java? </p>
