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 650445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:03:13+00:00 2026-05-13T22:03:13+00:00

Suppose I have a text that I can easily parse. It consists of text

  • 0

Suppose I have a text that I can easily parse. It consists of text and special identifiers. After parsing I get a list of tokens that correspond to text and special identifiers in the text.

The problem I am having is how do I transform it from this token list into some other form?

I can’t understand how to approach this problem.

I tried to build a parse tree but I don’t understand what to do next.

Please advise on this general problem of parsing.

  • 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-13T22:03:13+00:00Added an answer on May 13, 2026 at 10:03 pm

    Once you have a token stream, you can transform it into a parse tree by using a parser generator and specifying the grammar of your language.

    Depending on the programming language you’d like to use, you might want to look into the following parser generators:

    C/C++ – Yacc

    Java – ANTLR (also JavaCC, SableCC)

    Python – PLY (Python Lex / Yacc)

    OCaml – ocamlyacc

    If you don’t know about grammars, the documentation for the parser generator you choose should give you enough to get you going.

    When your parser is done, it will take the token stream and construct a tree using an intermediate representation – types that you define to represent the various pieces of your language (like the text and special identifiers that you mentioned). You can then manipulate the tree as you like.

    Edit: in response to your comment – I’m not quite sure what level of answer to give you, as I can’t tell exactly what problem you are having. First, are you familiar with tree data structures? If so, would you know how to write a simple recursive algorithm to find the height of a tree, or run a depth-first search? Remember that a tree is just a way to organize information – it is entirely up to you what you do with that information.

    A common design pattern for applying an algorithm to a heterogenous tree (ie a tree whose nodes are of different types) is the Visitor pattern. If you are already familiar with trees, you can look up an example of the Visitor pattern in your favorite language; however, if the concept is new to you I would strongly recommend starting off with the simpler algorithms for practice.

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

Sidebar

Related Questions

Suppose I have a text variable $$string . How can I write a boolean
Suppose I have a text file that says: This file has plain text Now,
Suppose you have a webpage that keeps refreshing, like so - how can you
I have this question in my text book: Suppose that we have a set
Suppose I have some text files (f1.txt, f2.txt, ...) that looks something like @article
Suppose we have a text editor application that runs with one separate process per
I'm in the process of writing a small text-editor that is supposed to have
I have a webview that's supposed to show cyrillic text wv.loadData( myStringHtml, html/text, utf-8);
I have several delimiters. For example {del1, del2, del3 }. Suppose I have text
Suppose I have a string of text, of all characters Latin-based. With punctuation. How

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.