Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7692157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:47:18+00:00 2026-05-31T20:47:18+00:00

I have a parse tree for my compiler, and i was wondering what traversal

  • 0

I have a parse tree for my compiler, and i was wondering what traversal of my parse tree will give me the same order in which my Source Code was tested for the generation,

I think it should be Pre-order, but i am told it is in-order , can someone tell me why.

Also, if i want to find out that in my parser, when was some declaration of identifiers was done, (say nonterminal declaration has the production for that) than what order of traversal shall i opt for. Pre-order?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:47:20+00:00Added an answer on May 31, 2026 at 8:47 pm

    You want to do an in-order traversal. If you do an in-order traversal on this AST, you’re visiting constructs in the order they’re written in the source.

    Also, if i want to find out that in my parser, when was some
    declaration of identifiers was done, (say nonterminal declaration has
    the production for that) than what order of traversal shall i opt for.
    Pre-order?

    Not quite sure what you mean here, but if you’re referring to finding the location (line, character, or column number) at which a symbol is declared, then that information should have been stored with the identifier AST node when it was inserted into the tree. Most parsers keep track of that information upon matching some token.

    However, it would be more efficient to store the location information along with the symbol table entry, instead of traversing the tree whenever you need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my parse tree with me, now I have traversed in order on
After creating the parse tree, i have to populate symbol table now. I have
I have parse json file which contain more than hundred location name, there latitude
I'm using Irony.net for generating a parse tree out of the source. Essentially I'm
As far as I know, the only way to parse Java source-code into an
I have to parse a tab-delimited text file with Ruby to extract some data
I have to parse a 1Gb XML file with a structure such as below
I have to parse the following data {ResultSet:{Query:microsec fin,Result: [{symbol:MICROSE_a.NS,name: MICROSEC FIN SERV LTD
I have to parse a String to create a PathSegmentCollection . The string is
I have to parse a file, and indeed a have to read it first,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.