[antlr-interest] Problem with integrating ANTLR with XAML

Sam Harwell sam at tunnelvisionlabs.com
Tue Jul 17 09:38:06 PDT 2012


Hi Glenn,

I have a couple questions to get started:

1. Are you trying to reference FormulaLexer within the XAML file, or does it
just happen to be located in the namespace FormulaPlotter?
2. Are the errors causing the build to fail, or simply showing in the errors
window while editing your project?

Thanks,
--
Sam Harwell
Owner, Lead Developer
http://tunnelvisionlabs.com

-----Original Message-----
From: Glenn Rowe (Orders) [mailto:orders at glennrowe.net] 
Sent: Tuesday, July 17, 2012 9:56 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Problem with integrating ANTLR with XAML

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

 

xmlns:local="clr-namespace:FormulaPlotter"

 

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?

Thanks.

Glenn.

 


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list