build errors with Antlr dependencies w/ vs2010

Oct 12, 2011 at 12:35 AM
Edited Oct 12, 2011 at 12:38 AM

Hi, I've downloaded the latest changeset and am trying to compile with visual studio 2010. After the project upgrade, I receive a number of errors, the first of which is:

Error 1 The type or namespace name 'Antlr' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Joel Martinez\dev\jint_a1e6deb9fc0c\Jint\Expressions\Statement.cs 2 7 Jint

Which is strange because the Antlr3.Runtime dependency is present and resolves correctly. So to get around it, I installed the latest build of Antlr via Nuget (install-package antlr), which then leads me to a whole host of other errors, the first of which is:

Error 3 The type or namespace name 'GrammarRuleAttribute' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Joel Martinez\dev\jint_a1e6deb9fc0c\Jint\Parser\ES3Lexer.cs 306 3 Jint

At that point, I went out to the antlr github site, cloned their repo and built the latest Antlr3 library, which I verified did include that class ... but then there were other errors, so before I keep going down the rabbit hole I figured I'd just post here and see what you guys thought on how to proceed. This is on pretty much a clean win7 install, with little else other than visual studio 2010 and a few other dev tools. Is there a dependency I'm missing?

I should also mention, my ultimate goal is to get a build of Jint that runs on Windows Phone/Silverlight. Any guidance you guys can offer along those lines would also be appreciated :-)

Oct 12, 2011 at 12:45 AM

Right now I would say the issue is due to the upgrade, as everything is working fine with VS2008.

What I know for sure is that under c# 4 you would have to remove the Func<> declarations first.

Oct 12, 2011 at 12:53 AM
Edited Oct 13, 2011 at 4:45 AM

Yeah I saw that ... but the upgrade by default doesn't change the target framework. So the errors I'm mentioning above are still for CLR 2.0, so in theory it shouldn't be related to that upgrade since it's really just an IDE/Project update, and not any changes to the target framework.

Do you guys have any plans to officially move support up for new frameworks (.net 3.5, .net 4, compact framework (wp7, xbox))?

Update: ok ... so I've got it compiling under VS2010 now, here's the steps I took:

  1. Upgrade project to 2010
  2. Change target framework to .net 3.5 client profile
  3. Comment out the delegates in JintEngine.cs (I made a placeholder delegate with a different name so the namespace still exists to avoid having to make changes in other files since the using statements were invalid if I remove the namespace entirely)
  4. Compile the latest version of the Antlr3 code from github (which is set for .net 3.5) and add a reference to that binary.

phew ... and people say Android is fragmented ;-)

Update 2:  The Antlr3.Runtime library has now been ported to a windows phone library. Unfortunately it required way too many code changes to easily contribute back because of missing types, and differences in underlying types (like GetObjectData being missing from the Exception class).

Update 3: Jint itself is now compiling on windows phone. However getting some exceptions with the DynamicMethod/Emit stuff ... investigating

Update 4: Sweet ... got it working :-)

Aug 25, 2012 at 4:30 PM
Edited Aug 25, 2012 at 4:31 PM

Post is kind of old, but with 2012 coming out and that fact that I ran into these same issues, I figure it really isn't dead.

Here is a post I found that (with some obvious editing) may solve #3 using a directive.  Delegates should probably be in their own file, too.

Dec 5, 2012 at 6:52 PM

I have been waiting for some news about this project regarding to its next release (compiling with .NET 4.0 and the latest Visual Studio or at least Visual Studio 2010). So far this project has been silent since its last update on August 2011. Hope to get a new release soon.

Dec 10, 2012 at 12:40 PM

Hi, just if someone is interested. To be able to compile the latest Jint (May 2012) with VS 2010, just download the latest ANTLR runtime DLL for Framework 2.0 from the ANTLR page.

After you replaced the reference from the "Dependencies" folder with the new ANTLR dll, everything compiles fine except the unit tests.



Dec 18, 2012 at 7:42 PM
Edited Dec 19, 2012 at 3:28 PM

Thanks to Manuel's suggestion, I am able to compile the whole project with .NET 4 Client Profile and Visual Studio 2010 including Test project. In order to compile the JINT solution, there are a number of changes particularly Func<> delegates (i.e. using System.Func<> for all of generic types, use JInt.Delegates.Func<> for Jint data types).