SitePoint Sponsor

User Tag List

Results 1 to 17 of 17

Thread: Parsing???

  1. #1
    junkyrddog's Other Half emmester's Avatar
    Join Date
    Mar 2001
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What the heck does it mean? LOL! This is probably a seriously newbie question, but I really don't know.

  2. #2
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    From ZBWEBOPEDIA.

    To PARSE:
    In linguistics, to divide language into small components that can be analyzed. For example, parsing this sentence would involve dividing it into words and phrases and identifying the type of each component (e.g., verb, adjective, or noun).
    Parsing is a very important part of many computer science disciplines. For example, compilers must parse source code to be able to translate it into object code. Likewise, any application that processes complex commands must be able to parse the commands. This includes virtually all end-user applications.

    Parsing is often divided into lexical analysis and semantic parsing. Lexical analysis concentrates on dividing strings into components, called tokens, based on punctuation and other keys. Semantic parsing then attempts to determine the meaning of the string.

  3. #3
    SitePoint Zealot
    Join Date
    May 2000
    Location
    Duluth, MN USA
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It means to interpert or process. for example, when you fill in a contact form and submit it, the form is read by a script, and the results are put into some format so they are meaningful and then delivered wherever they need to be delivered. The act of the script reading the input from the form and then sending some output is parsing.

    Does that make some sense?

    --Bill
    Lake Superior Smokin' Brews Make It Different: Brew Your Own!
    L'Etoile du Nord Web Development Providing Real Direction in a Virtual World
    MSN IM: smokinbrews-AT-hotmail-DOT-com
    Brewin', Vintin' & Smokin' Forums Moderator

  4. #4
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've just done one CS assignment, write a simple compiler, so I know by heart what is parsing and how painful it is to actually implement it!

    But if anyone is interested in seeing the code (open source ), here it is:
    http://son.cubedom.com/SL.cup
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  5. #5
    junkyrddog's Other Half emmester's Avatar
    Join Date
    Mar 2001
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a decent idea of what it is now...but I am still not sure...Nicky, your definition made the most sense. But, can you help me apply it to a situation, for example the form example...I am constantly hearing webmasters talking about parsing files, but I never know why. Why would you want to parse a file? *just confused self even more*

  6. #6
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Real life analogy required here.

    It's much like a person (the parser) reading an instruction manual (the code), and then performing the instructions in the manual to produce a new object, new application, create a new process, etc. (interpreting the code/executing all the functions/converting all the object code).

    Is that nice and clear?
    My 2 Cents (or is that 2.2 Cents including GST?)

  7. #7
    junkyrddog's Other Half emmester's Avatar
    Join Date
    Mar 2001
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by BC
    Real life analogy required here.

    It's much like a person (the parser) reading an instruction manual (the code), and then performing the instructions in the manual to produce a new object, new application, create a new process, etc. (interpreting the code/executing all the functions/converting all the object code).

    Is that nice and clear?
    Very.

    So, isn't the code always being parsed?

  8. #8
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can say that. All code in different forms or fashions are being parsed by something (whether it's a compiler, parser or another thing).

    e.g. A browser parses HTML and JavaScript to display text and images on your monitor screen
    My 2 Cents (or is that 2.2 Cents including GST?)

  9. #9
    junkyrddog's Other Half emmester's Avatar
    Join Date
    Mar 2001
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by BC
    You can say that. All code in different forms or fashions are being parsed by something (whether it's a compiler, parser or another thing).

    e.g. A browser parses HTML and JavaScript to display text and images on your monitor screen
    I get it now!

    But why do webmasters always say they are going to parse a file? Do they want to check it out or something?

  10. #10
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because the term 'parse' in web development has more relevance to server-side languages like ASP, PHP, etc. where parsing is an integral part of each language. You'll hardly ever hear people saying 'I need to parse my HTML file to return some results' but you'll hear plenty of web developers grumbling 'We need to parse the PHP code and return a new set of values that we can then insert into the MySQL DB...' etc. etc.
    My 2 Cents (or is that 2.2 Cents including GST?)

  11. #11
    SitePoint Enthusiast smirk's Avatar
    Join Date
    Dec 2000
    Location
    gibraltar ... for now...
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ???

    As far as I know..

    it means seperate..

    but that being said, like everything else there are a whole bunch of implications to that

    to parse or not to parse.. that is the question

  12. #12
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here are some contexts to which parsing applies in web programming.

    1) When you process form input (ie, user supplied text that is returned from a form in a html page) in a script you need to parse the text for a number of reasons.

    1.1) If you are going to save that string in a database you need to parse the string and escape any characters that are going to mess up the SQL syntax ' " \ these three characters will all corrupt an SQL string.

    1.2) For security you may need to parse the string to make sure that the user is not using your script as a malicious back door to the system.

    1.3) You may want to transform the user input from ASCII to html which would involve parsing the string and replacing carridge returns for <BR> tags.

    1.4) You may be capturing an email address from the user and want to do some simple validation to make sure that it is in a legal format xxx@xxx.xxx

    2) As already discussed, a compiler must parse the source code so as to acertain its symbolic meaning in order to compile machine instructions (object/machine code). Most compilers will parse the source code before attempting to compile it. Its sort of like the compiler checks the code for "puncuation" erros. Thus programmers are often having to debugg their code because the compiler couldn't make sence of the code when it parsed it. This is usually due to the programmer making syntax errors.

    3) Yes - the web is full of parsing There is a lot of parsing going on in generating dynamic web pages. The script has to be parsed, interpreted and executed on the server. The result is a stream of text that gets sent to the client which the browser must then parse as HTML in order to render the page for the user. If you come to web programming from a more traditional programming background - this is quite noticable. Almost everything is a string at some stage (whether it be variables imbedded into url using the get method, form data sent as a string using the post data).

  13. #13
    junkyrddog's Other Half emmester's Avatar
    Join Date
    Mar 2001
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freakysid
    Here are some contexts to which parsing applies in web programming.

    1) When you process form input (ie, user supplied text that is returned from a form in a html page) in a script you need to parse the text for a number of reasons.

    1.1) If you are going to save that string in a database you need to parse the string and escape any characters that are going to mess up the SQL syntax ' " \ these three characters will all corrupt an SQL string.

    1.2) For security you may need to parse the string to make sure that the user is not using your script as a malicious back door to the system.

    1.3) You may want to transform the user input from ASCII to html which would involve parsing the string and replacing carridge returns for <BR> tags.

    1.4) You may be capturing an email address from the user and want to do some simple validation to make sure that it is in a legal format xxx@xxx.xxx

    2) As already discussed, a compiler must parse the source code so as to acertain its symbolic meaning in order to compile machine instructions (object/machine code). Most compilers will parse the source code before attempting to compile it. Its sort of like the compiler checks the code for "puncuation" erros. Thus programmers are often having to debugg their code because the compiler couldn't make sence of the code when it parsed it. This is usually due to the programmer making syntax errors.

    3) Yes - the web is full of parsing There is a lot of parsing going on in generating dynamic web pages. The script has to be parsed, interpreted and executed on the server. The result is a stream of text that gets sent to the client which the browser must then parse as HTML in order to render the page for the user. If you come to web programming from a more traditional programming background - this is quite noticable. Almost everything is a string at some stage (whether it be variables imbedded into url using the get method, form data sent as a string using the post data).
    Thanks, that was really helpful.

  14. #14
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I think webmasters just like to hear themselves say it because it sounds intelligent. To tell you the truth it is a term I usually only apply to programming languages such as C++.

  15. #15
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Totally agree with Nicky
    We, webmasters, need to use "big" words.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  16. #16
    SitePoint Zealot Lor's Avatar
    Join Date
    Mar 2001
    Location
    cambridge, MA
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow - I finally understand this now!

  17. #17
    junkyrddog's Other Half emmester's Avatar
    Join Date
    Mar 2001
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Lor
    Wow - I finally understand this now!
    I'm glad that I'm not the only one.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •