Parsing means determining the syntactic structure of an expression, that is written according to the rules of a certain grammar. Suppose you are writing a calculator. You are fed a string like 17*(6+3/7)+sqrt(90+20/2)
. In order to evaluate that expression (and I don't mean just feeding it to eval
), you have to parse it according to the rules of the grammar, which might be the BODMAS rule (brackets of division, multiplication, addition & subtraction).
To parse that expression, you have to break it down into tokens (17, *, (, 6, +...) and verify that it adheres to the rules. Having done that, you can then start to process the data.
You usually parse something that can be very free-form in nature. For instance, you don't really parse the format of Unix's /etc/passwd password file, because it has a very rigid definition. Fields are delimited by colons, and each field has a precise defined purpose. You do, on the other hand, have to parse an SQL statement.
g r i n d e r