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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:26:33+00:00 2026-05-27T12:26:33+00:00

I have begun learning ANTLR in order to implement a domain-specific language (DSL) in

  • 0

I have begun learning ANTLR in order to implement a domain-specific language (DSL) in the future. I have purchased The Definitive ANTLR Reference and have begun working my way through it in order to familiarize myself with the program and the concepts of languages/compiler design. I have successfully gotten everything working within my environment (Visual Studio 2010 and C#), and I have successfully been able to create some basic grammars, as described throughout the book. Source code for java can be found here: http://pragprog.com/titles/tpantlr/source_code

However, while working through Chapter 3, I have come across a problem involving the classes not emitting errors to the console, as it shows in the book. I am using the same grammar that is used in the book, so I am assuming it has something to do with the C# runtimes. I am currently using ANTLRWorks to generate the lexer/parser, and I am using the 3.4 ANTLR distribution runtimes for CSharp3 (Antlr3.Runtime.dll and Antlr4.StringTemplate.dll).

Is this a known issue? If not, should I try using an older version of the runtimes or ANTLRWorks?

The grammar I am using:

grammar Expr;

options
{
   language = CSharp3;
}

prog    :   stat+ ;

stat    :   expr NEWLINE
|   ID '=' expr NEWLINE
|       NEWLINE
;

expr    :   multExpr (('+'|'-') multExpr)*
;

multExpr 
:   atom('*' atom)*
;

atom    :   INT
|   ID
|   '(' expr ')'
;

ID  :   ('a'..'z'|'A'..'Z')+ ;
INT :   '0'..'9'+ ;
NEWLINE :   '\r'? '\n';
WS  :   (' '|'\t')+ {Skip();};

I will post the C# classes if anyone needs to see them, but they are very long, so I will hold off until someone requests them. Thank you.

  • 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-27T12:26:34+00:00Added an answer on May 27, 2026 at 12:26 pm

    I’ve only worked with the CSharp2 target (and runtime) because I’ve not been able to get the CSharp3 target running on my Ubuntu-machine with MonoDevelop.

    When you use ANTLRWorks, the org.antlr.Tool is used to generate the ExprLexer.cs and ExprParser.cs classes, which the CSharp3 runtime has (sometimes?) issues with, if memory serves me well.

    Try generating the .cs source files with the Antlr3.exe tool instead: http://www.tunnelvisionlabs.com/downloads/antlr/antlr-dotnet-tool-3.4.1.9004.7z (note that tunnelvisionlabs.com is from the author of the CSharp3 target).

    I haven’t tested this, because of my unfamiliarity with the CSharp3 target, but it’s worth a try.

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

Sidebar

Related Questions

I've recently begun learning C# but have encountered an annoying problem. Every variable I
I have just begun working on a project which uses Mercurial as a version
I have just begun working with the Android SDK and I am having problems
I've just begun learning Silverlight (though I have 3 years C# experience). I'm trying
So I have begun learning OpenGL, reading from the book OpenGL Super Bible 5
I have recently begun learning the Win32 API using this tutorial: http://www.winprog.org/tutorial/ (though I'm
I have just begun learning Python. Eventually I will learn Django, as my goal
So I have just begun learning the Django framework, and I am trying to
I've just begun learning Unix and have so far encountered two elementary though difficult
In learning C, I've just begun studying pointers to structures and have some questions.

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.