[antlr-interest] Problem with integrating ANTLR with XAML

Glenn Rowe (Orders) orders at glennrowe.net
Tue Jul 17 07:56:16 PDT 2012

I'm relatively new to ANTLR and as a test I wrote a sample program that uses
ANTLR to define a grammar that allows

mathematical expressions such as x^2 + 4*x*cos(x) to be entered and then
have a graph of the function drawn.

The program is written in C# using WPF and XAML to define the layout, and
uses the ANTLR3 plugin for Visual Studio 2010.


Everything works fine unless I try to define an xmlns namespace alias for
the local namespace in which the program's code is written

in MainWindow.xaml. That is, I add the line




to the Window tag at the start of the XAML file, where FormulaPlotter is the
namespace of my code. Doing this generates 8

errors of the sort 


FormulaLexer does not have a constructor with 1 argument (although it does)

start() method not found


and other errors complaining about constructors or methods in the lexer or
parser not being found.


The only workaround I have found for this is to write the relevant bits of
the program in the C# code-behind file,

which is quite awkward for some of the stuff I want to do.


Does anyone know of a fix for this problem?




More information about the antlr-interest mailing list