[antlr-interest] Problem with integrating ANTLR with XAML

Sam Harwell sam at tunnelvisionlabs.com
Tue Jul 17 10:48:57 PDT 2012


A few more questions:

Did you follow the instructions in the Documentation section here? In
particular, can you verify that sections 1.4 and 2.1 were incorporated
correctly?
http://www.antlr.org/wiki/display/ANTLR3/Antlr3CSharpReleases

Are you using the 3.4.1.9004 release of the C# port of ANTLR 3?

Did you make any changes to the .targets file from the one included in the
Releases listed on that page?

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 11:48 AM
To: 'Sam Harwell'; antlr-interest at antlr.org
Subject: RE: [antlr-interest] Problem with integrating ANTLR with XAML

Hi Sam:

I don't try to reference FormulaLexer or FormulaParser in the XAML file, but
I need some of the other classes in the FormulaPlotter namespace in the
XAML. I've tried putting the ANTLR stuff in a different namespace from the
MainWindow stuff, but it doesn't help.
I've also tried putting the C# code that references the ANTLR stuff in a
separate namespace from MainWindow but that didn't help either.

Basically, the program has a DataGrid which is data-bound to a DataTable, in
which I store the strings representing the formulas to be plotted and the
colour of the plot line and so on. The user enters the formula and colour in
the DataGrid in the GUI and these are connected to the DataTable via data
binding.
So I'd like to be able to refer to the DataTable in the XAML in order to
bind some of the display properties to entries in the DataTable.

The errors cause the build to fail. I know that sometimes ANTLR will show
errors in the errors window which go away when you do a build, but these
errors are 'real'
errors
that cause a build fail.

> -----Original Message-----
> From: Sam Harwell [mailto:sam at tunnelvisionlabs.com]
> Sent: 17 July 2012 17:38
> To: 'Glenn Rowe (Orders)'; antlr-interest at antlr.org
> Subject: RE: [antlr-interest] Problem with integrating ANTLR with XAML
> 
> 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