Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Parse

by grinder (Bishop)
on Aug 08, 2001 at 23:25 UTC ( #103183=note: print w/replies, xml ) Need Help??

in reply to What does the word "parse" mean?

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://103183]
[Jeri]: I'm about to leave work!!!
[Jeri]: wooooo hooooo!

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2017-02-23 21:51 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (351 votes). Check out past polls.