3

Flee is really great, but are anyone aware of a C# port of it?

I saw a mention of this in one of the answers to this question: Compiling C# on the fly

I would prefer c# to be able to handle possible issues that might arise myself.

Community
  • 1
  • 1
Lars KJ
  • 632
  • 7
  • 15
  • How about using a VB.NET to C# converter? – Uwe Keim Sep 25 '12 at 18:37
  • 1
    I have a C# port of the Silverlight compatible version, I don't know if I'm permitted to distribute it though (perhaps legally I _must_). But I pretty much did as Uwe Keim, suggested ran it through a VB to C# converter which did 80% of the work, then cleaned up the rest. – Chris Sinclair Sep 25 '12 at 18:39
  • It would be fantastic if you could share this with the world, have you used it in production. – Lars KJ Sep 25 '12 at 18:47
  • Yes, used in production. No, sorry, I can't release the source code at this time. But trust me when I say, it's pretty much a straight VB to C# conversion using Telerik's automated tool: http://converter.telerik.com/ And fixing some types that don't exist in the Silverlight BCL (IIRC, I needed to convert the non-generic `Stack` to a generic `Stack<>` and some other minor type quibbles). If the intent is to understand the library, you can do the port (didn't take long) or learn VB. Even if there's some minor bug from a port oversight, it should be sufficient to figure out what it's doing. – Chris Sinclair Sep 25 '12 at 20:16
  • Also, FYI, the library leverages Grammatica which is available in C#: http://grammatica.percederberg.net/ – Chris Sinclair Sep 25 '12 at 20:17
  • One last mention, the branch I ported was the Silverlight compatible one which has a reduced feature set: http://flee.codeplex.com/workitem/8121 So if you use the full source available from their repository, I can't guarantee if the VB to C# converter tool will work or if you'll get functional results. – Chris Sinclair Sep 25 '12 at 20:20
  • You could use Jace : [Github repo](https://github.com/pieterderycke/Jace) – NicoJuicy Jul 13 '17 at 13:08

3 Answers3

9

Given that Flee is written in Visual Basic .NET, you can use it directly from C#. Translating between the two languages is typically fairly easy, and can often be done using online automatic converters.

However, if you really want to avoid it, you may be able to use NCalc instead, which also provides nice expression parsing for .NET, and is written in C#.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
  • 1
    I have tried NCalc which is nice and easy to use, but much slower than Flee, at least in the scenarios that I have at hand. – Lars KJ Sep 25 '12 at 18:48
  • 1
    @LarsKJ Yeah - just depends on what you're doing, and what your requirements are. Not using it because it's in VB would be a shame, IMO. Easier to just use the library, and do any conversions from C# to VB as necessary, IMO, than try to work with a port (which will be out of date, etc) or anything else. – Reed Copsey Sep 25 '12 at 18:52
  • I am using Flee today as it was the best alternative for us, but when investigating an possible issue I had a real hard time understanding the VB.Net code. The issue that I had turned out to be in other parts and not Flee. Anyhow it gave be bad feelings not being able to fully read and understand Flee. – Lars KJ Sep 25 '12 at 19:05
  • 2
    @LarsKJ: Maybe you should have bad feelings if and when you actually have some genuine problems with Flee. I use libraries all the time without understanding their source code. Imagine having to decipher jQuery before being comfortable using it. – Robert Harvey Sep 25 '12 at 19:10
  • I accepted your answer as I will try out the conversion track, as the matter of fact Flee contains a grammar to Flee author actual converted to VB from C# make things easier. Any – Lars KJ Sep 26 '12 at 05:13
  • Opps continue.. The jQuery example is somewhat misleading as it is an large well maintained library with huge usage base, Flee on the other hand is small and original author seems to have abandoned it - in those cases I always like to know a bit more about it. Guess I am a control freak. – Lars KJ Sep 26 '12 at 05:25
1

Looks like there was a recent conversion, here: http://fleesharp.codeplex.com/.

I've switched to use it for a project I'm working on and haven't noticed any errors.

Laurence
  • 1,673
  • 11
  • 16
1

I am the author of CSharpEval (http://csharpeval.codeplex.com). Performance should be similar to Jace.NET, as the end result is a compiled function. Also, CSharpEval is being actively developed (as I am using it in existing projects)

EnderWiggin
  • 525
  • 6
  • 7