Notices
Results 1 to 4 of 4

Thread: Syntax Analysis parsing methods questions

  1. #1 Syntax Analysis parsing methods questions 
    New Member
    Join Date
    Mar 2014
    Posts
    3
    Hi all!

    I have a question regarding the top-down and bottom-up approach being used during the Syntax Analysis of a compiler. I couldn't find a clear answer on this (even in the dragonbook).

    What I don't understand:
    Are these top-down/bottom-up methods being used to actually construct a parse tree? Or are these being used to check whether an input string matches a grammar, by going through an existing parse tree? And if the latter, where does the tree come from? How was it generated?

    Thank you very much!


    Reply With Quote  
     

  2.  
     

  3. #2  
    Forum Radioactive Isotope MagiMaster's Avatar
    Join Date
    Jul 2006
    Posts
    3,440
    For compilers you typically want to generate a parse tree as that is how you generate the final code. (You don't typically generate the whole parse tree, just the bits you need as you go.) You can use the same techniques to check if a string matches a grammar, but not by comparing it to an existing parse tree. You'd simply build a new one and if it's possible then the string matches the grammar.


    Reply With Quote  
     

  4. #3  
    New Member
    Join Date
    Mar 2014
    Posts
    3
    Thank you for your answer! It is more clear now. But so I understand that those bits of the parse tree (not the entire parse tree) can also be called a ''multi-pass''?

    Reply With Quote  
     

  5. #4  
    Forum Radioactive Isotope MagiMaster's Avatar
    Join Date
    Jul 2006
    Posts
    3,440
    No, multi-pass would be doing the parse multiple times. For example, once to collect all the variable and function names and again to generate the code using those names.
    Reply With Quote  
     

Similar Threads

  1. 3 questions regarding circuit analysis
    By mr.science in forum Electrical and Electronics
    Replies: 2
    Last Post: April 3rd, 2011, 11:16 PM
  2. Dr Syntax
    By marcusclayman in forum Site Feedback
    Replies: 14
    Last Post: December 10th, 2009, 11:02 AM
  3. OBJ-C Syntax Question
    By collred in forum Computer Science
    Replies: 1
    Last Post: December 7th, 2009, 07:02 PM
  4. Syntax tree's to Finitie state machines..?
    By blackout83 in forum Computer Science
    Replies: 1
    Last Post: May 24th, 2009, 05:21 AM
  5. parsing questions.
    By rich in forum Computer Science
    Replies: 0
    Last Post: August 27th, 2007, 03:31 AM
Bookmarks
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
  •