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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:18:51+00:00 2026-06-06T08:18:51+00:00

Here is the background, I am trying to create a DSL to allow customer

  • 0

Here is the background, I am trying to create a DSL to allow customer write simple scripts to query into our mongodb based database. I choose antlr to implement the DSL.

From my understanding (and pls let me know if it’s not correct) there are 2 approaches to integrate antlr generated parser into the system:

  1. Embed code into the grammar file so that the generated parser could
    be used directly to make query to the database and return result in
    a certain format (e.g. json encoded)
  2. Keep the parser purely a parser, after feed the DSL file to it, and construct the query in another class by retrieving the AST from generated parser class

So antlrers, which one do you think is the way I as an antlr newbie should go? Can you list the pros and cos of each approach, or you have other way to recommend?

  • 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-06-06T08:18:52+00:00Added an answer on June 6, 2026 at 8:18 am

    You should not embed business logic into your parser, because of potential maintenance headaches: you do not want to recompile your grammar to fix bugs in business logic, let alone the nightmarish prospects of having to debug your business logic inside a generated parser. So option one should be out of the question for anything other than the smallest toy projects.

    Option two can be implemented in more than one way: you can (A) have ANTLR generate AST nodes for you, and write a tree parser, or (B) you could skip the tree parser, and produce your own representation in the actions of the parser. I tried both approaches on production projects, both in Java and in C#, and both these approaches worked very well. I think the choice between (A) and (B) is largely a matter of your personal taste, as long as the business logic is kept out of the parser.

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

Sidebar

Related Questions

I'm trying to create a simple animation in which the background-color slides into place.
I'm trying create a simple background periodic task using Django-Celery-RabbitMQ combination. I installed Django
I'm trying to draw a button with an image as background. Here's my xml:
Can't change the body background for some reason, here is how I am trying
I am trying to create custom background selector for my ExpandableListView. It works fine
I'm trying to create a semi-transparent user control button whose background opacity changes from
I am trying to create a drawable in code and change the color based
I am trying create a 'live' view where our clients can edit the colors
This is my first plugin trying to create using the example provided here .
for some hours im trying to create a graphpaper background for a ListView. For

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.