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.