[antlr-interest] ANTLR on Microsoft's Compact Framework?

André van der Merwe AndrevdM at pyrogenesis.co.za
Tue Sep 15 13:46:45 PDT 2009


Its working. Sam you were right all I needed to compile was Antlr.Runtime.



I needed to make a few changed to get it to compile for the CF. In case someone else wants to do this in the future here is what I did

* Created a new CF project and added all the existing .cs files 

* Add "DOTNET2" to the defines

* In AssemblyInfo.cs: Comment out AllowPartiallyTrustedCallers

* In Stats.cs: Replace call to Environment.GetCurrentPath with Asm.GetExecutingAssembly().GetName().CodeBase

* In ErrorManager.cs: Remove all references to StackTrace and StackFrame. It should be possible to get the required information from looking at the Exception parameter's StackTrace property and parsing the string. However I've just set the location to an empty string for now. (Fortunately for me, error handeling is not too important in my DSL)

* In TokenRewriteStream.cs: Replace call to Array.GetRange with a call to a custom method that does what GetRange does.

* In BaseRecogniser.cs: Throw a NotImplementedException in GetRuleInvocationStack(). Again it should be possible to parse the stack trace string but I'm not using this method so I'm just throwing.


All in all it was pretty simple to get working. 



-----Original Message-----
From: Sam Harwell [mailto:sharwell at pixelminegames.com] 
Sent: 14 September 2009 16:49
To: André van der Merwe; antlr-interest at antlr.org
Subject: RE: [antlr-interest] ANTLR on Microsoft's Compact Framework?

Are you trying to run a generated parser, or are you actually trying to run Antlr3.exe on the CF to generate your parser?

If you only want to run the generated parser, then you probably only need to compile Antlr3.Runtime.dll (CSharp3 target) or Antlr.Runtime.dll (CSharp/CSharp2 target).

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of André van der Merwe
Sent: Sunday, September 13, 2009 4:05 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] ANTLR on Microsoft's Compact Framework?

Hi,

Has anyone managed to get an ANTLR generated parser (C#) working on the .net compact framework?

I doubt there are any major issues with the generated code but the references are going to be a problem. Before I go and recompile everything for the CF I wanted to check if there were known issues or perhaps someone has already done this?




More information about the antlr-interest mailing list