Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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


Comment on Re: Parse
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://103183]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2015-07-28 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls