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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:04:41+00:00 2026-05-11T15:04:41+00:00

I am trying to develop a mini DSL for software configuration, using antlworks for

  • 0

I am trying to develop a mini DSL for software configuration, using antlworks for prototyping. A typical source would look like:

name: myname; value: myvalue; flag debug {    value = debugvalue; } if flag(debug) {    libname = foo_d; } else {    libname = foo; } 

Now, I never got a formal course on parsing, so I am doing all this by trial/error from antlworks and some basics on BNF grammars. One constant problem I encounter is whitespace and newline handling. I defined something like

program:    statement* EOF;  statement: compound_statement | selection_statement | field_statement; selection_statement:    'if' expr statement; statement_list: (WS* statement)+; compound_statement: '{' statement_list? '}'; field_statement: name_statement | value_statement; name_statement: 'name' WS* ':' WS* WORD WS* ';'; value_statement: 'value' WS* ':' WS* WORD WS* ';';  // Tokens WS  :   (' ' | '\t' | '\n'); WORD:   ('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z'|'0'..'9'|'_')*; 

But the whitespace handling is very buggy, it breaks for all kind of cases. What it the standard way of doing this ? Is there any resource to learn this kind of things quickly (something like building a calculator with conditional and variables in antlr – the antlr grammars I found are either trivial and full-fledge languages).

  • 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. 2026-05-11T15:04:42+00:00Added an answer on May 11, 2026 at 3:04 pm

    Usually, you would do this by adding

    { $channel=HIDDEN; } 

    action to the WS rule; see this page, section Lexer rules for details.

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

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try replacing this line: setTimeout('this.feedbackTag.removeChild(info)', 5000); with these two lines:… May 11, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer You could write a batch script that runs the exe… May 11, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer You can do something like this on the target page:… May 11, 2026 at 11:53 pm

Related Questions

I am trying to develop a multimedia site and I am leaning heavily toward
I am trying to develop a .NET Web Project using NHibernate and Spring.NET, but
I am trying to develop a iphone app by using cocos2d. I create a
I am trying to develop a text-to-speech editor in .NET 3.5 using C#. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.