<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>Flee Wiki &amp; Documentation Rss Feed</title><link>http://www.codeplex.com/Flee/Wiki/View.aspx?title=Home</link><description>Flee Wiki Rss Description</description><item><title>New Comment on "LanguageReference"</title><link>http://flee.codeplex.com/wikipage?title=LanguageReference&amp;ANCHOR#C25994</link><description>Hi, is there possible for me to write a multiline expression&amp;#63;&amp;#10;Example&amp;#58;&amp;#10;This is vb format&amp;#10;If a &amp;#62; 0 then&amp;#10;  If a &amp;#60;&amp;#61; 1 then&amp;#10;     X &amp;#61; b &amp;#42; &amp;#40; a &amp;#42; 1.5 &amp;#41;&amp;#10;  else&amp;#10;     X &amp;#61; &amp;#40; 1.5 &amp;#43; &amp;#40; a - 1 &amp;#41; &amp;#42; 2 &amp;#41; &amp;#42; b&amp;#10;  end if&amp;#10;else&amp;#10;  X &amp;#61; 0&amp;#10;End if&amp;#10;&amp;#10;If y &amp;#61; 1 then &amp;#10;  X &amp;#61; X &amp;#42; 2&amp;#10;End if &amp;#10;&amp;#10;How to write this into expression without using custom function. because i write the formula in texbox, and it is impossible for me to write them to custom function.</description><author>aph31</author><pubDate>Fri, 21 Dec 2012 08:58:28 GMT</pubDate><guid isPermaLink="false">New Comment on "LanguageReference" 20121221085828A</guid></item><item><title>New Comment on "GettingStarted"</title><link>http://flee.codeplex.com/wikipage?title=GettingStarted&amp;ANCHOR#C24051</link><description>&amp;#64;bhrnjica&amp;#10;For that you need custom functions and a bit of black magic&amp;#58;&amp;#10;    public static class CustomFunctions&amp;#123;&amp;#10;        public static double isZero&amp;#40;double x&amp;#41; &amp;#123; &amp;#10;            return &amp;#40;x &amp;#61;&amp;#61; 0.0&amp;#41; &amp;#63; 1.0 &amp;#58; 0.0&amp;#59;&amp;#10;        &amp;#125;&amp;#10;    &amp;#125;&amp;#10;&amp;#10;    class Program &amp;#123;&amp;#10;&amp;#10;        static void Main&amp;#40;string&amp;#91;&amp;#93; args&amp;#41; &amp;#123;&amp;#10;            ExpressionContext context &amp;#61; new ExpressionContext&amp;#40;&amp;#41;&amp;#59;&amp;#10;            IDynamicExpression eDynamic&amp;#59;&amp;#10;            double r1, r2&amp;#59;&amp;#10;&amp;#10;            context.Imports.AddType&amp;#40;typeof&amp;#40;CustomFunctions&amp;#41;&amp;#41;&amp;#59;&amp;#10;            context.Variables.Add&amp;#40;&amp;#34;a1&amp;#34;, 0.0&amp;#41;&amp;#59;&amp;#10;            context.Variables.Add&amp;#40;&amp;#34;a2&amp;#34;, 0.0&amp;#41;&amp;#59;&amp;#10;            eDynamic &amp;#61; context.CompileDynamic&amp;#40;&amp;#34;isZero&amp;#40;a2&amp;#41;&amp;#42;1.0 &amp;#43; &amp;#40;1.0-isZero&amp;#40;a2&amp;#41;&amp;#41;&amp;#42;&amp;#40;a1&amp;#47;&amp;#40;a2&amp;#43;isZero&amp;#40;a2&amp;#41;&amp;#41;&amp;#41;&amp;#34;&amp;#41;&amp;#59;&amp;#10;&amp;#10;            context.Variables&amp;#91;&amp;#34;a1&amp;#34;&amp;#93; &amp;#61; 1.0&amp;#59;&amp;#10;&amp;#10;            &amp;#47;&amp;#47; a2 zero&amp;#10;            context.Variables&amp;#91;&amp;#34;a2&amp;#34;&amp;#93; &amp;#61; 0.0&amp;#59;&amp;#10;            r1 &amp;#61; &amp;#40;double&amp;#41;eDynamic.Evaluate&amp;#40;&amp;#41;&amp;#59;&amp;#10;&amp;#10;            &amp;#47;&amp;#47; a2 not zero&amp;#10;            context.Variables&amp;#91;&amp;#34;a2&amp;#34;&amp;#93; &amp;#61; 10.0&amp;#59;&amp;#10;            r2 &amp;#61; &amp;#40;double&amp;#41;eDynamic.Evaluate&amp;#40;&amp;#41;&amp;#59;&amp;#10;&amp;#10;            Console.WriteLine&amp;#40;&amp;#34;&amp;#123;0&amp;#125;&amp;#92;n&amp;#123;1&amp;#125;&amp;#34;, r1, r2&amp;#41;&amp;#59;&amp;#10;        &amp;#125;&amp;#10;    &amp;#125;</description><author>0x69</author><pubDate>Wed, 13 Jun 2012 11:04:01 GMT</pubDate><guid isPermaLink="false">New Comment on "GettingStarted" 20120613110401A</guid></item><item><title>New Comment on "GettingStarted"</title><link>http://flee.codeplex.com/wikipage?title=GettingStarted&amp;ANCHOR#C24040</link><description>For that you need custom functions and a bit of black magic&amp;#58;&amp;#10;&amp;#10;    public static class CustomFunctions&amp;#123;&amp;#10;        public static double isZero&amp;#40;double x&amp;#41; &amp;#123; &amp;#10;            return &amp;#40;x &amp;#61;&amp;#61; 0.0&amp;#41; &amp;#63; 1.0 &amp;#58; 0.0&amp;#59;&amp;#10;        &amp;#125;&amp;#10;    &amp;#125;&amp;#10;&amp;#10;    class Program &amp;#123;&amp;#10;&amp;#10;        static void Main&amp;#40;string&amp;#91;&amp;#93; args&amp;#41; &amp;#123;&amp;#10;            ExpressionContext context &amp;#61; new ExpressionContext&amp;#40;&amp;#41;&amp;#59;&amp;#10;            IDynamicExpression eDynamic&amp;#59;&amp;#10;            double result&amp;#59;&amp;#10;&amp;#10;            context.Imports.AddType&amp;#40;typeof&amp;#40;CustomFunctions&amp;#41;&amp;#41;&amp;#59;&amp;#10;&amp;#10;            context.Variables&amp;#91;&amp;#34;a1&amp;#34;&amp;#93; &amp;#61; 1.0&amp;#59;&amp;#10;&amp;#10;            &amp;#47;&amp;#47; a2 zero&amp;#10;            context.Variables&amp;#91;&amp;#34;a2&amp;#34;&amp;#93; &amp;#61; 0.0&amp;#59;&amp;#10;            eDynamic &amp;#61; context.CompileDynamic&amp;#40;&amp;#34;isZero&amp;#40;a2&amp;#41;&amp;#42;1.0 &amp;#43; &amp;#40;1.0-isZero&amp;#40;a2&amp;#41;&amp;#41;&amp;#42;&amp;#40;a1&amp;#47;&amp;#40;a2&amp;#43;isZero&amp;#40;a2&amp;#41;&amp;#41;&amp;#41;&amp;#34;&amp;#41;&amp;#59;&amp;#10;            result &amp;#61; &amp;#40;double&amp;#41;eDynamic.Evaluate&amp;#40;&amp;#41;&amp;#59;&amp;#10;            Console.WriteLine&amp;#40;&amp;#34;&amp;#123;0&amp;#125;&amp;#34;, result&amp;#41;&amp;#59;&amp;#10;&amp;#10;            &amp;#47;&amp;#47; a2 not zero&amp;#10;            context.Variables&amp;#91;&amp;#34;a2&amp;#34;&amp;#93; &amp;#61; 10.0&amp;#59;&amp;#10;            eDynamic &amp;#61; context.CompileDynamic&amp;#40;&amp;#34;isZero&amp;#40;a2&amp;#41;&amp;#42;1.0 &amp;#43; &amp;#40;1.0-isZero&amp;#40;a2&amp;#41;&amp;#41;&amp;#42;&amp;#40;a1&amp;#47;&amp;#40;a2&amp;#43;isZero&amp;#40;a2&amp;#41;&amp;#41;&amp;#41;&amp;#34;&amp;#41;&amp;#59;&amp;#10;            result &amp;#61; &amp;#40;double&amp;#41;eDynamic.Evaluate&amp;#40;&amp;#41;&amp;#59;&amp;#10;            Console.WriteLine&amp;#40;&amp;#34;&amp;#123;0&amp;#125;&amp;#34;, result&amp;#41;&amp;#59;&amp;#10;        &amp;#125;&amp;#10;    &amp;#125;</description><author>0x69</author><pubDate>Tue, 12 Jun 2012 15:21:43 GMT</pubDate><guid isPermaLink="false">New Comment on "GettingStarted" 20120612032143P</guid></item><item><title>New Comment on "LanguageReference"</title><link>http://flee.codeplex.com/wikipage?title=LanguageReference&amp;ANCHOR#C23878</link><description>This is very useful project , thanks.I don&amp;#39;t know how to implement a switch,case structure with it. eg&amp;#58; &amp;#10;switch&amp;#40;number&amp;#41;&amp;#10;&amp;#123;&amp;#10;    case 0&amp;#58;&amp;#10;         number&amp;#42;3&amp;#59;&amp;#10;    case 1&amp;#58;&amp;#10;        return 5&amp;#10;    case 2&amp;#58;&amp;#10;        return number&amp;#42;2&amp;#10;     &amp;#10;&amp;#125;&amp;#10;&amp;#10;Can we do it with flee if statements&amp;#63; Please help me.</description><author>tiger2009</author><pubDate>Wed, 30 May 2012 05:02:13 GMT</pubDate><guid isPermaLink="false">New Comment on "LanguageReference" 20120530050213A</guid></item><item><title>New Comment on "ImportingTypes"</title><link>http://flee.codeplex.com/wikipage?title=ImportingTypes&amp;ANCHOR#C22499</link><description>&amp;#64;leithfx&amp;#10;You could encapsulate your double in a custom type and exposed this type on the ExpressionOwner &amp;#40;as a Property or a method returning the instanciated type&amp;#41;.&amp;#10;This way you will be able to overload the &amp;#61;&amp;#61; operator on your custom type and implement the custom behavior you are looking for.</description><author>pulsarblow</author><pubDate>Tue, 07 Feb 2012 20:20:21 GMT</pubDate><guid isPermaLink="false">New Comment on "ImportingTypes" 20120207082021P</guid></item><item><title>New Comment on "Examples"</title><link>http://flee.codeplex.com/wikipage?title=Examples&amp;ANCHOR#C20686</link><description>this is good. By can I use this to filter some lists of objects like in the http&amp;#58;&amp;#47;&amp;#47;stackoverflow.com&amp;#47;q&amp;#47;7026855&amp;#47;185593 &amp;#10;&amp;#10;Or, may I use this code to compare with Enumeration values, like in http&amp;#58;&amp;#47;&amp;#47;stackoverflow.com&amp;#47;q&amp;#47;7075816&amp;#47;185593&amp;#10;&amp;#63;</description><author>serhhio</author><pubDate>Tue, 16 Aug 2011 10:07:56 GMT</pubDate><guid isPermaLink="false">New Comment on "Examples" 20110816100756A</guid></item><item><title>New Comment on "ImportingTypes"</title><link>http://flee.codeplex.com/wikipage?title=ImportingTypes&amp;ANCHOR#C20250</link><description>Is it possible to overload the &amp;#61; operator on doubles so that I can make it compare more loosely &amp;#40;i.e because of floating point precision, 1.1 &amp;#43; 2.2 doesnt equal 3.3&amp;#41;.  I would like to override the &amp;#61; operator to be more of an almost equals behaviour...</description><author>leithfx</author><pubDate>Thu, 07 Jul 2011 20:31:16 GMT</pubDate><guid isPermaLink="false">New Comment on "ImportingTypes" 20110707083116P</guid></item><item><title>New Comment on "LanguageReference"</title><link>http://flee.codeplex.com/wikipage?title=LanguageReference&amp;ANCHOR#C18660</link><description>I am woking with your dll and I&amp;#39;m trying to evaluate the following expression, but it fails to compile&amp;#58;if&amp;#40;5 in &amp;#40;1 , 5&amp;#41; and 9 in &amp;#40;3 , 6 , 4&amp;#41; and 15 in &amp;#40;7 , 8&amp;#41; and 24 in &amp;#40;8 , 8&amp;#41; and 31 in &amp;#40;3, 3&amp;#41;  ,&amp;#34;True&amp;#34;,&amp;#34;False&amp;#34;&amp;#41;&amp;#10;The problem is because the expression length. May you give some clue about it, in order to fix the problem.</description><author>rocarnet</author><pubDate>Tue, 22 Feb 2011 21:45:28 GMT</pubDate><guid isPermaLink="false">New Comment on "LanguageReference" 20110222094528P</guid></item><item><title>Updated Wiki: LanguageReference</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=LanguageReference&amp;version=30</link><description>&lt;div class="wikidoc"&gt;&lt;b&gt;Language Reference&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The expression language that Flee uses is a mix of elements of C# and VB.Net. Since the aim of this library is speed, the language is strongly typed (same rules as C#) and there is no late binding. Unlike C#, the language is &lt;b&gt;not&lt;/b&gt; case-sensitive.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Contents&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="#ArithmeticOperators"&gt;ArithmeticOperators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#ComparisonOperators"&gt;ComparisonOperators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#AndOrXorNotOperators"&gt;AndOrXorNotOperators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#ShiftOperators"&gt;ShiftOperators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Concatenation"&gt;Concatenation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Indexing"&gt;Indexing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Literals"&gt;Literals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Casting"&gt;Casting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#ConditionalOperator"&gt;ConditionalOperator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#InOperator"&gt;InOperator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#OverloadedOperatorsOnTypes"&gt;Overloaded Operators On Types&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;Arithmetic Operators&lt;/b&gt;&lt;a name="ArithmeticOperators"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports all the standard arithmetic operators as well as the modulo (%) and power (^) operators.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;a*2 + b ^ 2 - 100 % 5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ComparisonOperators&lt;/b&gt;&lt;a name="ComparisonOperators"&gt;&lt;/a&gt;&lt;br /&gt;All the comparison operators are supported as well.  The not equal operator is &lt;span class="codeInline"&gt;&amp;lt;&amp;gt;&lt;/span&gt; and the equal operator is &lt;span class="codeInline"&gt;=&lt;/span&gt;&lt;br /&gt;Example: &lt;span class="codeInline"&gt;a &amp;lt;&amp;gt; 100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;And/Or/Xor/Not Operators&lt;/b&gt;&lt;a name="AndOrXorNotOperators"&gt;&lt;/a&gt;&lt;br /&gt;Flee uses these operators for both logical and bitwise operations.  Since the expression language is strongly-typed, Flee can determine the types of the operands to these operators.  If both operands are booleans, then the operation is logical.  If both are integral, the operation is bitwise.  Any other combination results in a compile error.&lt;br /&gt;Example (logical): &lt;span class="codeInline"&gt;a &amp;gt; 100 And Not b = 100&lt;/span&gt;&lt;br /&gt;Example (bitwise): &lt;span class="codeInline"&gt;(100 or 2) and 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Shift Operators&lt;/b&gt;&lt;a name="ShiftOperators"&gt;&lt;/a&gt;&lt;br /&gt;The left (&amp;lt;&amp;lt;) and right (&amp;gt;&amp;gt;) shift operators do a bitwise shift and are only valid on integral types.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;100 &amp;gt;&amp;gt; 2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Concatenation&lt;/b&gt;&lt;a name="Concatenation"&gt;&lt;/a&gt;&lt;br /&gt;The + operator also serves as the string concatenation operator.  If either of its operands is a string, it will perform a concatenate instead of an addition.  It is valid for only one operand to be a string in which case, both operands are converted to Object and formatted accordingly.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;&amp;quot;abc&amp;quot; + &amp;quot;def&amp;quot;&lt;/span&gt;&lt;br /&gt;Example: &lt;span class="codeInline"&gt;&amp;quot;the number is: &amp;quot; + 100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Indexing&lt;/b&gt;&lt;a name="Indexing"&gt;&lt;/a&gt;&lt;br /&gt;The indexing operator takes the form: &lt;span class="codeInline"&gt;member[indexExpression]&lt;/span&gt;.  Any expression can appear inside the brackets.  If the member being indexed is an array, Flee will emit optimized array element loading instructions.  If the indexed member has a default indexer property, flee will call the property with the evaluated index.  Indexing a type which is not an array and does not have a default indexer generates a compile exception.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;arr[i + 1] + 100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Literals&lt;/b&gt;&lt;a name="Literals"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports the following literals in expressions:
&lt;ul&gt;&lt;li&gt;&lt;b&gt;Char&lt;/b&gt; - A character in single quotes: &lt;span class="codeInline"&gt;'a'&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Boolean&lt;/b&gt; - Either &lt;span class="codeInline"&gt;true&lt;/span&gt; or &lt;span class="codeInline"&gt;false&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Real&lt;/b&gt; - Any number with a decimal point.  You can use the 'd', 'f', or 'm' suffixes to specify whether the number should be stored in a double, single, or decimal respectively.  Use the ExpressionOptions.RealLiteralDataType option to specify the data type used to store the number when no suffix is specified.  The default is double.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Integral&lt;/b&gt; - Any number without a decimal point.  Append &amp;quot;L&amp;quot; to force the number to a 64-bit integer and/or a &amp;quot;U&amp;quot; to force it to unsigned.  Flee will try to assign an integer literal to the first integral type that can contain the value.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Hex&lt;/b&gt; - Integral constants can also be specified in hex notation: &lt;span class="codeInline"&gt;0xFF12&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;String&lt;/b&gt; - String literals are enclosed in double quotes and escaping characters follows the same rules as C#: &lt;span class="codeInline"&gt;&amp;quot;string\u0021\r\n a \&amp;quot;new\&amp;quot; line&amp;quot;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Null&lt;/b&gt; - Using the keyword &lt;span class="codeInline"&gt;null&lt;/span&gt; will load the null reference into an expression.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;DateTime&lt;/b&gt; - A valid .NET DateTime pattern surrounded by #'s.  Use the &lt;span class="codeInline"&gt;ExpressionOptions.DateTimeFormat&lt;/span&gt; property to control the format.  Example:  &lt;span class="codeInline"&gt;#08/06/2008#.ToLongDateString()&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TimeSpan&lt;/b&gt; - A string in the format &lt;span class="codeInline"&gt;##[d.]hh:mm[:ss[.ff]]#&lt;/span&gt;.  Example: &lt;span class="codeInline"&gt;#08/06/2008# + ##1.23:45#&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;Casting&lt;/b&gt;&lt;a name="Casting"&gt;&lt;/a&gt;&lt;br /&gt;Casting is performed using the special cast function which takes the form &lt;span class="codeInline"&gt;cast(value, type)&lt;/span&gt;.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;100 + cast(obj, int)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conditional Operator&lt;/b&gt;&lt;a name="ConditionalOperator"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports a conditional operator that allows you to pick a result based on a boolean condition.  It is implemented as a special function of the form &lt;span class="codeInline"&gt;if(condition, whenTrue, whenFalse)&lt;/span&gt;.  The operator is a &amp;quot;true&amp;quot; conditional operator: only the expression that matches the condition is evaluated.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;If(a &amp;gt; 100 and b &amp;gt; 10, &amp;quot;both greater&amp;quot;, &amp;quot;less&amp;quot;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In Operator&lt;/b&gt;&lt;a name="InOperator"&gt;&lt;/a&gt;&lt;br /&gt;The In operator is a boolean binary operator that returns true if its first operand is contained in its second operand.  It has two forms
&lt;ul&gt;&lt;li&gt;&lt;b&gt;List&lt;/b&gt;: Searches a list of values for a given value: &lt;span class="codeInline"&gt;value IN (value1, value2, value3,...)&lt;/span&gt;.  The value is compared against each value in the list and &lt;span class="codeInline"&gt;true&lt;/span&gt; is returned if the value is found, &lt;span class="codeInline"&gt;false&lt;/span&gt; if no match is found.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Collection&lt;/b&gt;: Searches a single collection for a given value: &lt;span class="codeInline"&gt;value IN collection&lt;/span&gt;.  The collection variable must implement &lt;span class="codeInline"&gt;ICollection&amp;lt;T&amp;gt;&lt;/span&gt;, &lt;span class="codeInline"&gt;IDictionary&amp;lt;K,V&amp;gt;&lt;/span&gt;, &lt;span class="codeInline"&gt;IList&lt;/span&gt;, or &lt;span class="codeInline"&gt;IDictionary&lt;/span&gt; for the expression to compile.  Arrays can be searched with this operator as they implement the first interface.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;Example (List): &lt;span class="codeInline"&gt;If(100 in (100, 200, 300, -1), &amp;quot;in&amp;quot;, &amp;quot;not in&amp;quot;)&lt;/span&gt;&lt;br /&gt;Example (Collection): &lt;span class="codeInline"&gt;if(100 in collection, &amp;quot;in&amp;quot;, &amp;quot;not in&amp;quot;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Overloaded Operators On Types&lt;/b&gt;&lt;a name="OverloadedOperatorsOnTypes"&gt;&lt;/a&gt;&lt;br /&gt;When evaluating an arithmetic, comparison, or conversion operation where the operands are not primitives, Flee will look for and use any overloaded operators defined on the operands.  This means that you can create expressions such as &lt;span class="codeInline"&gt;a + b&lt;/span&gt; (where a and b are custom types), as long as there is an addition operator defined on either operand.&lt;/div&gt;</description><author>ECiloci</author><pubDate>Thu, 18 Jun 2009 16:34:22 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LanguageReference 20090618043422P</guid></item><item><title>Updated Wiki: Home</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=Home&amp;version=36</link><description>&lt;div class="wikidoc"&gt;&lt;b&gt;Project Description&lt;/b&gt;&lt;br /&gt;Flee is an expression parser and evaluator for the .NET framework.  It allows you to compute the value of string expressions such as &lt;span class="codeInline"&gt;sqrt(a^2 + b^2)&lt;/span&gt; at runtime.  It uses a custom compiler, strongly-typed expression language, and lightweight codegen to compile expressions directly to IL.  This means that expression evaluation is extremely fast and efficient.  Try out the &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=demo"&gt;demo&lt;/a&gt;, which lets you generate images based on expressions, and see for yourself.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Features&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Fast and efficient expression evaluation &lt;/li&gt;
&lt;li&gt;Small, lightweight library &lt;/li&gt;
&lt;li&gt;Compiles expressions to IL using a custom compiler, lightweight codegen, and the DynamicMethod class&lt;/li&gt;
&lt;li&gt;Expressions (and the IL generated for them) are garbage-collected when no longer used&lt;/li&gt;
&lt;li&gt;Does not create any dynamic assemblies that stay in memory &lt;/li&gt;
&lt;li&gt;Backed by a comprehensive suite of unit tests&lt;/li&gt;
&lt;li&gt;Culture-sensitive decimal point&lt;/li&gt;
&lt;li&gt;Fine-grained control of what types an expression can use&lt;/li&gt;
&lt;li&gt;Supports all arithmetic operations including the power (^) operator &lt;/li&gt;
&lt;li&gt;Supports string, char, boolean, and floating-point literals &lt;/li&gt;
&lt;li&gt;Supports 32/64 bit, signed/unsigned, and hex integer literals &lt;/li&gt;
&lt;li&gt;Features a true conditional operator &lt;/li&gt;
&lt;li&gt;Supports short-circuited logical operations &lt;/li&gt;
&lt;li&gt;Supports arithmetic, comparison, implicit, and explicit overloaded operators&lt;/li&gt;
&lt;li&gt;Variables of any type can be dynamically defined and used in expressions&lt;/li&gt;
&lt;li&gt;CalculationEngine: Reference other expressions in an expression and recalculate in natural order&lt;/li&gt;
&lt;li&gt;Expressions can index arrays and collections, access fields and properties, and call functions on various types&lt;/li&gt;
&lt;li&gt;Generated IL can be saved to an assembly and viewed with a disassembler&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;More information&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=Examples"&gt;Examples&lt;/a&gt; to learn how to create and evaluate expressions.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=LanguageReference"&gt;Language Reference&lt;/a&gt; for information on the expression language.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=FAQ"&gt;Frequently Asked Questions&lt;/a&gt; about using Flee.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/useritems/Flee.asp" class="externalLink"&gt;Article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on CodeProject for a more detailed overview.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;License&lt;/b&gt;&lt;br /&gt;Flee is licensed under the LGPL.  This means that as long as you dynamically link (ie: add a reference) to the officially released assemblies, you can use it in commercial and non-commercial applications.&lt;/div&gt;</description><author>ECiloci</author><pubDate>Wed, 17 Jun 2009 17:23:32 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20090617052332P</guid></item><item><title>Updated Wiki: Home</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=Home&amp;version=35</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Project Description&lt;/b&gt;&lt;br /&gt;Flee is an expression parser and evaluator for the .NET framework.  It allows you to compute the value of string expressions such as &lt;span class="codeInline"&gt;sqrt(a^2 + b^2)&lt;/span&gt; at runtime.  It uses a custom compiler, strongly-typed expression language, and lightweight codegen to compile expressions directly to IL.  This means that expression evaluation is extremely fast and efficient.  Try out the &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=demo&amp;amp;referringTitle=Home"&gt;demo&lt;/a&gt;, which lets you generate images based on expressions, and see for yourself.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Features&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;Fast and efficient expression evaluation &lt;/li&gt;&lt;li&gt;Small, lightweight library &lt;/li&gt;&lt;li&gt;Compiles expressions to IL using a custom compiler, lightweight codegen, and the DynamicMethod class&lt;/li&gt;&lt;li&gt;Expressions (and the IL generated for them) are garbage-collected when no longer used&lt;/li&gt;&lt;li&gt;Does not create any dynamic assemblies that stay in memory &lt;/li&gt;&lt;li&gt;Backed by a comprehensive suite of unit tests&lt;/li&gt;&lt;li&gt;Culture-sensitive decimal point&lt;/li&gt;&lt;li&gt;Fine-grained control of what types an expression can use&lt;/li&gt;&lt;li&gt;Supports all arithmetic operations including the power (^) operator &lt;/li&gt;&lt;li&gt;Supports string, char, boolean, and floating-point literals &lt;/li&gt;&lt;li&gt;Supports 32/64 bit, signed/unsigned, and hex integer literals &lt;/li&gt;&lt;li&gt;Features a true conditional operator &lt;/li&gt;&lt;li&gt;Emits short-circuited logical operations &lt;/li&gt;&lt;li&gt;Supports arithmetic, comparison, implicit, and explicit overloaded operators&lt;/li&gt;&lt;li&gt;Variables of any type can be dynamically defined and used in expressions&lt;/li&gt;&lt;li&gt;CalculationEngine: Reference other expressions in an expression and recalculate in natural order&lt;/li&gt;&lt;li&gt;Expressions can index arrays and collections, access fields and properties, and call functions on various types&lt;/li&gt;&lt;li&gt;Generated IL can be saved to an assembly and viewed with a disassembler&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;More information&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=Examples&amp;amp;referringTitle=Home"&gt;Examples&lt;/a&gt; to learn how to create and evaluate expressions.&lt;/li&gt;&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=LanguageReference&amp;amp;referringTitle=Home"&gt;Language Reference&lt;/a&gt; for information on the expression language.&lt;/li&gt;&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=FAQ&amp;amp;referringTitle=Home"&gt;Frequently Asked Questions&lt;/a&gt; about using Flee.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.codeproject.com/useritems/Flee.asp" class="externalLink"&gt;Article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on CodeProject for a more detailed overview.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;License&lt;/b&gt;&lt;br /&gt;Flee is licensed under the LGPL.  This means that as long as you dynamically link (ie: add a reference) to the officially released assemblies, you can use it in commercial and non-commercial applications.&lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Sat, 28 Mar 2009 23:29:56 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20090328112956P</guid></item><item><title>Updated Wiki: LanguageReference</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=LanguageReference&amp;version=29</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Language Reference&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;The expression language that Flee uses is a mix of elements of C# and VB.Net. Since the aim of this library is speed, the language is strongly typed (same rules as C#) and there is no late binding. Unlike C#, the language is &lt;b&gt;not&lt;/b&gt; case-sensitive.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Contents&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#ArithmeticOperators"&gt;ArithmeticOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ComparisonOperators"&gt;ComparisonOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#AndOrXorNotOperators"&gt;AndOrXorNotOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ShiftOperators"&gt;ShiftOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Concatenation"&gt;Concatenation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Indexing"&gt;Indexing&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Literals"&gt;Literals&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Casting"&gt;Casting&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ConditionalOperator"&gt;ConditionalOperator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#InOperator"&gt;InOperator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#OverloadedOperatorsOnTypes"&gt;Overloaded Operators On Types&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;Arithmetic Operators&lt;/b&gt;&lt;a name="ArithmeticOperators"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports all the standard arithmetic operators as well as the modulo (%) and power (^) operators.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;a*2 + b ^ 2 - 100 % 5&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;ComparisonOperators&lt;/b&gt;&lt;a name="ComparisonOperators"&gt;&lt;/a&gt;&lt;br /&gt;All the comparison operators are supported as well.  The not equal operator is &lt;span class="codeInline"&gt;&amp;lt;&amp;gt;&lt;/span&gt; and the equal operator is &lt;span class="codeInline"&gt;=&lt;/span&gt;&lt;br /&gt;Example: &lt;span class="codeInline"&gt;a &amp;lt;&amp;gt; 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;And/Or/Xor/Not Operators&lt;/b&gt;&lt;a name="AndOrXorNotOperators"&gt;&lt;/a&gt;&lt;br /&gt;Flee uses these operators for both logical and bitwise operations.  Since the expression language is strongly-typed, Flee can determine the types of the operands to these operators.  If both operands are booleans, then the operation is logical.  If both are integral, the operation is bitwise.  Any other combination results in a compile error.&lt;br /&gt;Example (logical): &lt;span class="codeInline"&gt;a &amp;gt; 100 And Not b = 100&lt;/span&gt;&lt;br /&gt;Example (bitwise): &lt;span class="codeInline"&gt;(100 or 2) and 1&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Shift Operators&lt;/b&gt;&lt;a name="ShiftOperators"&gt;&lt;/a&gt;&lt;br /&gt;The left (&amp;lt;&amp;lt;) and right (&amp;gt;&amp;gt;) shift operators do a bitwise shift and are only valid on integral types.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;100 &amp;gt;&amp;gt; 2&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Concatenation&lt;/b&gt;&lt;a name="Concatenation"&gt;&lt;/a&gt;&lt;br /&gt;The + operator also serves as the string concatenation operator.  If either of its operands is a string, it will perform a concatenate instead of an addition.  It is valid for only one operand to be a string in which case, both operands are converted to Object and formatted accordingly.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;&amp;quot;abc&amp;quot; + &amp;quot;def&amp;quot;&lt;/span&gt;&lt;br /&gt;Example: &lt;span class="codeInline"&gt;&amp;quot;the number is: &amp;quot; + 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Indexing&lt;/b&gt;&lt;a name="Indexing"&gt;&lt;/a&gt;&lt;br /&gt;The indexing operator takes the form: &lt;span class="codeInline"&gt;member[indexExpression]&lt;/span&gt;.  Any expression can appear inside the brackets.  If the member being indexed is an array, Flee will emit optimized array element loading instructions.  If the indexed member has a default indexer property, flee will call the property with the evaluated index.  Indexing a type which is not an array and does not have a default indexer generates a compile exception.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;arr[i + 1] + 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Literals&lt;/b&gt;&lt;a name="Literals"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports the following literals in expressions:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Char&lt;/b&gt; - A character in single quotes: &lt;span class="codeInline"&gt;'a'&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Boolean&lt;/b&gt; - Either &lt;span class="codeInline"&gt;true&lt;/span&gt; or &lt;span class="codeInline"&gt;false&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Real&lt;/b&gt; - Any number with a decimal point is treated as a double-precision floating-point number.  Append a &amp;quot;f&amp;quot; to force the number to single-precision.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Integral&lt;/b&gt; - Any number without a decimal point.  Append &amp;quot;L&amp;quot; to force the number to a 64-bit integer and/or a &amp;quot;U&amp;quot; to force it to unsigned.  Flee will try to assign an integer literal to the first integral type that can contain the value.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Hex&lt;/b&gt; - Integral constants can also be specified in hex notation: &lt;span class="codeInline"&gt;0xFF12&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;String&lt;/b&gt; - String literals are enclosed in double quotes and escaping characters follows the same rules as C#: &lt;span class="codeInline"&gt;&amp;quot;string\u0021\r\n a \&amp;quot;new\&amp;quot; line&amp;quot;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Null&lt;/b&gt; - Using the keyword &lt;span class="codeInline"&gt;null&lt;/span&gt; will load the null reference into an expression.&lt;/li&gt;&lt;li&gt;&lt;b&gt;DateTime&lt;/b&gt; - A valid .NET DateTime pattern surrounded by #'s.  Use the &lt;span class="codeInline"&gt;ExpressionOptions.DateTimeFormat&lt;/span&gt; property to control the format.  Example:  &lt;span class="codeInline"&gt;#08/06/2008#.ToLongDateString()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;TimeSpan&lt;/b&gt; - A string in the format &lt;span class="codeInline"&gt;##[d.]hh:mm[:ss[.ff]]#&lt;/span&gt;.  Example: &lt;span class="codeInline"&gt;#08/06/2008# + ##1.23:45#&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;Casting&lt;/b&gt;&lt;a name="Casting"&gt;&lt;/a&gt;&lt;br /&gt;Casting is performed using the special cast function which takes the form &lt;span class="codeInline"&gt;cast(value, type)&lt;/span&gt;.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;100 + cast(obj, int)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Conditional Operator&lt;/b&gt;&lt;a name="ConditionalOperator"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports a conditional operator that allows you to pick a result based on a boolean condition.  It is implemented as a special function of the form &lt;span class="codeInline"&gt;if(condition, whenTrue, whenFalse)&lt;/span&gt;.  The operator is a &amp;quot;true&amp;quot; conditional operator: only the expression that matches the condition is evaluated.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;If(a &amp;gt; 100 and b &amp;gt; 10, &amp;quot;both greater&amp;quot;, &amp;quot;less&amp;quot;)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;In Operator&lt;/b&gt;&lt;a name="InOperator"&gt;&lt;/a&gt;&lt;br /&gt;The In operator is a boolean binary operator that returns true if its first operand is contained in its second operand.  It has two forms&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;List&lt;/b&gt;: Searches a list of values for a given value: &lt;span class="codeInline"&gt;value IN (value1, value2, value3,...)&lt;/span&gt;.  The value is compared against each value in the list and &lt;span class="codeInline"&gt;true&lt;/span&gt; is returned if the value is found, &lt;span class="codeInline"&gt;false&lt;/span&gt; if no match is found.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Collection&lt;/b&gt;: Searches a single collection for a given value: &lt;span class="codeInline"&gt;value IN collection&lt;/span&gt;.  The collection variable must implement &lt;span class="codeInline"&gt;ICollection&amp;lt;T&amp;gt;&lt;/span&gt;, &lt;span class="codeInline"&gt;IDictionary&amp;lt;K,V&amp;gt;&lt;/span&gt;, &lt;span class="codeInline"&gt;IList&lt;/span&gt;, or &lt;span class="codeInline"&gt;IDictionary&lt;/span&gt; for the expression to compile.  Arrays can be searched with this operator as they implement the first interface.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;Example (List): &lt;span class="codeInline"&gt;If(100 in (100, 200, 300, -1), &amp;quot;in&amp;quot;, &amp;quot;not in&amp;quot;)&lt;/span&gt;&lt;br /&gt;Example (Collection): &lt;span class="codeInline"&gt;if(100 in collection, &amp;quot;in&amp;quot;, &amp;quot;not in&amp;quot;)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Overloaded Operators On Types&lt;/b&gt;&lt;a name="OverloadedOperatorsOnTypes"&gt;&lt;/a&gt;&lt;br /&gt;When evaluating an arithmetic, comparison, or conversion operation where the operands are not primitives, Flee will look for and use any overloaded operators defined on the operands.  This means that you can create expressions such as &lt;span class="codeInline"&gt;a + b&lt;/span&gt; (where a and b are custom types), as long as there is an addition operator defined on either operand.&lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Sat, 21 Mar 2009 18:33:36 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LanguageReference 20090321063336P</guid></item><item><title>Updated Wiki: ImportingTypes</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=ImportingTypes&amp;version=17</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Extending the functions available to an expression&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;Flee allows you to extend the functions available for use in its expressions.  Because of Flee's design, you are not required to define adapter classes or use delegates.  You simply define your functions in a class or  use the functions of an existing class and Flee will do the rest.  Note that reflection is only used to lookup the functions when the expression is compiled.  When the expression is evaluated, the functions are called using IL instructions just like in a compiled assembly.&lt;br /&gt; &lt;br /&gt;The following is a guide to the various ways to add custom functions to an expression:&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Importing public, static functions&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;Define a class with all the public, static functions that you want to use:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public static class CustomFunctions
{
   public static int Product(int a, int b)
   {
      return a * b;
   }
 
   public static int Sum(int a, int b)
   {
      return a + b;
   }
}
&lt;/pre&gt; &lt;br /&gt;Then use the Imports property of the ExpressionContext class to make them available for use in the expression:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
ExpressionContext context = new ExpressionContext();
context.Imports.AddType(typeof(CustomFunctions));
context.Variables.Add(&amp;quot;a&amp;quot;, 100);
context.Variables.Add(&amp;quot;b&amp;quot;, 200);
 
IDynamicExpression e = context.CompileDynamic(&amp;quot;product(a,b) + sum(a,b)&amp;quot;);
int result = (int) e.Evaluate();
&lt;/pre&gt; &lt;br /&gt;You can also import all the functions into a namespace:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
context.Imports.AddType(typeof(CustomFunctions), &amp;quot;functions&amp;quot;);
IDynamicExpression e = context.CompileDynamic(&amp;quot;functions.product(a,b) + a - b&amp;quot;);
&lt;/pre&gt; &lt;br /&gt;This also works for the built-in .NET types:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
ExpressionContext context = new ExpressionContext();
context.Imports.AddType(typeof(Math));
context.Variables.Add(&amp;quot;a&amp;quot;, 100);
 
IDynamicExpression e = context.CompileDynamic(&amp;quot;cos(a)&amp;quot;);
int result = (int) e.Evaluate();
&lt;/pre&gt; &lt;br /&gt;&lt;b&gt;Importing instance functions using variables&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;Since variables act as instances of their type, you can call any public, instance functions defined on them.  Here's an example that demonstrates this:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
ExpressionContext context = new ExpressionContext();
context.Variables.Add(&amp;quot;rand&amp;quot;, new Random());
 
IDynamicExpression e = context.CompileDynamic(&amp;quot;rand.nextDouble() + 100&amp;quot;);
double result = (double) e.Evaluate();
&lt;/pre&gt; &lt;br /&gt;&lt;b&gt;Importing function using an expression owner&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;When you attach an expression to an &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=ExpressionOwner&amp;amp;referringTitle=ImportingTypes"&gt;expression owner&lt;/a&gt;, you can use any public/non-public static/instance functions on the owner class.  The only limitation is that the functions cannot be put in a separate namespace.  Here's the previous example, using the Random class as the expression owner:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
Random rand = new Random();
ExpressionContext context = new ExpressionContext(rand);
 
IDynamicExpression e = context.CompileDynamic(&amp;quot;nextDouble() + 100&amp;quot;);
double result = (double) e.Evaluate();
&lt;/pre&gt; &lt;br /&gt;&lt;b&gt;Type-safety&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;Flee performs type-checking on the return type and parameters of all imported functions and will throw an ExpressionCompileException if either is not valid in the context of the expression.  Flee will also not allow calls to functions that do not return a value.&lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Sat, 21 Mar 2009 18:24:59 GMT</pubDate><guid isPermaLink="false">Updated Wiki: ImportingTypes 20090321062459P</guid></item><item><title>Updated Wiki: Home</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=Home&amp;version=34</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Project Description&lt;/b&gt;&lt;br /&gt;Flee is an expression parser and evaluator for the .NET framework.  It allows you to compute the value of string expressions such as &lt;span class="codeInline"&gt;sqrt(a^2 + b^2)&lt;/span&gt; at runtime.  It uses a custom compiler, strongly-typed expression language, and lightweight codegen to compile expressions directly to IL.  This means that expression evaluation is extremely fast and efficient.  Try out the &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=demo&amp;amp;referringTitle=Home"&gt;demo&lt;/a&gt;, which lets you generate images based on expressions, and see for yourself.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Features&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;Fast and efficient expression evaluation &lt;/li&gt;&lt;li&gt;Small, lightweight library &lt;/li&gt;&lt;li&gt;Compiles expressions to IL using a custom compiler, lightweight codegen, and the DynamicMethod class&lt;/li&gt;&lt;li&gt;Expressions (and the IL generated for them) are garbage-collected when no longer used&lt;/li&gt;&lt;li&gt;Does not create any dynamic assemblies that stay in memory &lt;/li&gt;&lt;li&gt;Backed by a comprehensive suite of unit tests&lt;/li&gt;&lt;li&gt;Culture-sensitive decimal point&lt;/li&gt;&lt;li&gt;Fine-grained control of what types an expression can use&lt;/li&gt;&lt;li&gt;Supports all arithmetic operations including the power (^) operator &lt;/li&gt;&lt;li&gt;Supports string, char, boolean, and floating-point literals &lt;/li&gt;&lt;li&gt;Supports 32/64 bit, signed/unsigned, and hex integer literals &lt;/li&gt;&lt;li&gt;Features a true conditional operator &lt;/li&gt;&lt;li&gt;Emits short-circuited logical operations &lt;/li&gt;&lt;li&gt;Supports arithmetic, comparison, implicit, and explicit overloaded operators&lt;/li&gt;&lt;li&gt;Variables of any type can be dynamically defined and used in expressions&lt;/li&gt;&lt;li&gt;CalculationEngine: Reference other expressions in an expression and recalculate in natural order&lt;/li&gt;&lt;li&gt;Expressions can index arrays and collections, access fields and properties, and call functions on various types&lt;/li&gt;&lt;li&gt;Generated IL can be saved to an assembly and viewed with a disassembler&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;More information&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=Examples&amp;amp;referringTitle=Home"&gt;Examples&lt;/a&gt; to learn how to create and evaluate expressions.&lt;/li&gt;&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=LanguageReference&amp;amp;referringTitle=Home"&gt;Language Reference&lt;/a&gt; for information on the expression language.&lt;/li&gt;&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=FAQ&amp;amp;referringTitle=Home"&gt;Frequently Asked Questions&lt;/a&gt; about using Flee.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.codeproject.com/useritems/Flee.asp" class="externalLink"&gt;Article&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; on CodeProject for a more detailed overview.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;License&lt;/b&gt;&lt;br /&gt;Flee is licensed under the LGPL.  This means that as long as you dynamically link (ie: add a reference) to the officially released assemblies, you can use it in commercial and non-commercial applications.&lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Sat, 28 Feb 2009 19:44:50 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20090228074450P</guid></item><item><title>Updated Wiki: FAQ</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=FAQ&amp;version=3</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Frequently Asked Questions&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;When I create an expression such as &lt;span class="codeInline"&gt;1/2&lt;/span&gt;, why is the result 0 instead of 0.5?&lt;/b&gt;&lt;br /&gt;When an arithmetic operation involves two integers, the result will be an integer.  If either or both operands are floating-point, then the result will be floating-point.  In the above case, since both operands are integers, an integer division is performed and yields 0.  This is a performance feature which makes sure that expressions that perform arithmetic involving only integers will use the more efficient and faster integer instructions.&lt;br /&gt; &lt;br /&gt;Workarounds:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;Make either operand a real number: 1/2.0 or 1.0/2&lt;/li&gt;&lt;li&gt;Use the &lt;span class="codeInline"&gt;ExpressionOptions.IntegersAsDoubles&lt;/span&gt; option to force Flee to treat all integer literals as doubles.  With this option set, &lt;span class="codeInline"&gt;1/2&lt;/span&gt; will evaluate to 0.5.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;Why do I get compile exceptions when I call functions with multiple real number arguments and my culture uses ',' as the decimal separator (ie: sum(1,23, 4,56))?&lt;/b&gt;&lt;br /&gt;When the decimal separator for real numbers is set to ',', Flee has to use a different character as the argument delimiter for functions otherwise the grammar becomes ambiguous.  To avoid the ambiguity, Flee uses the list separator character from the parse culture as the delimiter for function arguments.&lt;br /&gt; &lt;br /&gt;Example:&lt;br /&gt;en-US: &lt;span class="codeInline"&gt;sum(1.23, 4.56)&lt;/span&gt;&lt;br /&gt;fr-FR: &lt;span class="codeInline"&gt;sum(1,23; 4,56)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;If you really want to use ',' for both the decimal separator and function arguments, you can set the &lt;span class="codeInline"&gt;ExpressionContext.ParserOptions.RequireDigitsBeforeDecimalPoint&lt;/span&gt; property to true.  This will require all real numbers to have a digit before the decimal point (ie: 0.45 instead of .45) but will eliminate the grammar ambiguity.&lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Sat, 28 Feb 2009 19:43:20 GMT</pubDate><guid isPermaLink="false">Updated Wiki: FAQ 20090228074320P</guid></item><item><title>Updated Wiki: CustomizingParser</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=CustomizingParser&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
Flee allows customization of its expression parser.  Customizing the parser is done through the &lt;span class="codeInline"&gt;ExpressionContext.ParserOptions&lt;/span&gt; property.  You set the properties to the values you want and then call &lt;span class="codeInline"&gt;RecreateParser&lt;/span&gt; to apply your changes.&lt;br /&gt; &lt;br /&gt;Here's an example:&lt;br /&gt;&lt;pre&gt;
ExpressionContext context = new ExpressionContext();
context.Imports.AddType(typeof(Math))
 
context.CompileDynamic(&amp;quot;max(1.23, 4.56)&amp;quot;, context);
 
context.ParserOptions.DecimalSeparator = ',';
context.ParserOptions.FunctionArgumentSeparator = ';';
context.RecreateParser();
 
context.CompileDynamic(&amp;quot;max(1,23; 4,56)&amp;quot;, context);
&lt;/pre&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Sat, 28 Feb 2009 19:34:55 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CustomizingParser 20090228073455P</guid></item><item><title>Updated Wiki: Examples</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=Examples&amp;version=35</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Examples&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;This page contains links to code samples that demonstrate how to use Flee:&lt;br /&gt;&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=GettingStarted&amp;amp;referringTitle=Examples"&gt;Getting started&lt;/a&gt;: Quick guide to evaluating expressions&lt;/li&gt;&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=ImportingTypes&amp;amp;referringTitle=Examples"&gt;Extending&lt;/a&gt; the functions available to an expression&lt;/li&gt;&lt;li&gt;Using &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=ExpressionVariables&amp;amp;referringTitle=Examples"&gt;Variables&lt;/a&gt; in expressions&lt;/li&gt;&lt;li&gt;Using Flee to evaluate &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=BooleanExpression&amp;amp;referringTitle=Examples"&gt;boolean expressions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Using an &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=ExpressionOwner&amp;amp;referringTitle=Examples"&gt;expression owner&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Using the &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=CalculationEngine&amp;amp;referringTitle=Examples"&gt;calculation engine&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Retrieving values from &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=IndexedMembers&amp;amp;referringTitle=Examples"&gt;arrays and collections&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=CultureSensitiveExpressions&amp;amp;referringTitle=Examples"&gt;Culture&lt;/a&gt; sensitive expressions&lt;/li&gt;&lt;li&gt;&lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=CustomizingParser&amp;amp;referringTitle=Examples"&gt;Customizing&lt;/a&gt; Flee's parser&lt;/li&gt;&lt;li&gt;Calling functions with a &lt;a href="http://flee.codeplex.com/Wiki/View.aspx?title=ParamArrayFunctions&amp;amp;referringTitle=Examples"&gt;variable&lt;/a&gt; number of arguments&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Sat, 28 Feb 2009 19:25:58 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Examples 20090228072558P</guid></item><item><title>Updated Wiki: CalculationEngine</title><link>http://flee.codeplex.com/Wiki/View.aspx?title=CalculationEngine&amp;version=13</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Using the Calculation Engine&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;The &lt;span class="codeInline"&gt;CalculationEngine&lt;/span&gt; allows you to create a network of expressions.  The engine allows expressions to reference the results of other expressions in the engine, tracks dependencies, and recalculates in natural order.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
// Create the calculation engine
CalculationEngine engine = new CalculationEngine();
ExpressionContext context = new ExpressionContext();
VariableCollection variables = context.Variables;
 
// Add some variables
variables.Add(&amp;quot;x&amp;quot;, 100);            
variables.Add(&amp;quot;y&amp;quot;, 200);
 
// Add an expression to the calculation engine as &amp;quot;a&amp;quot;
engine.Add(&amp;quot;a&amp;quot;, &amp;quot;x * 2&amp;quot;, context);
 
// Add an expression to the engine as &amp;quot;b&amp;quot;
engine.Add(&amp;quot;b&amp;quot;, &amp;quot;y + 100&amp;quot;, context);
            
// Add an expression at &amp;quot;c&amp;quot; that uses the results of &amp;quot;a&amp;quot; and &amp;quot;b&amp;quot;
engine.Add(&amp;quot;c&amp;quot;, &amp;quot;a + b&amp;quot;, context);
            
// Get the value of &amp;quot;c&amp;quot;
int result = engine.GetResult&amp;lt;int&amp;gt;(&amp;quot;c&amp;quot;);
 
// Update a variable on the &amp;quot;a&amp;quot; expression            
variables[&amp;quot;x&amp;quot;] = 200;
 
// Recalculate it
engine.Recalculate(&amp;quot;a&amp;quot;);
 
// Get the updated result
result = engine.GetResult&amp;lt;int&amp;gt;(&amp;quot;c&amp;quot;);
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;Another example&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;Here is an example &lt;a href="javascript:window.location.href='http://flee.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=25529';"&gt;project&lt;/a&gt; that shows how to use the CalculationEngine to implement a simple templating system.  It reads a template file which has marked up tags such as &lt;span class="codeInline"&gt;Mr. &amp;lt;FullName&amp;gt;, you owe &amp;lt;Debt&amp;gt;&lt;/span&gt;.  Once all the tags are loaded, it asks the user to enter an expression for each tag.  Since we are using the calculation engine, the expression for each tag can reference the result of other tag expressions.  Once all the expressions are entered, the CalculationEngine does a recalculate.  The program then substitutes the result of each tag into the template and outputs the result.&lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Sat, 28 Feb 2009 19:24:25 GMT</pubDate><guid isPermaLink="false">Updated Wiki: CalculationEngine 20090228072425P</guid></item><item><title>Updated Wiki: LanguageReference</title><link>http://www.codeplex.com/Flee/Wiki/View.aspx?title=LanguageReference&amp;version=28</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Language Reference&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;The expression language that Flee uses is a mix of elements of C# and VB.Net. Since the aim of this library is speed, the language is strongly typed (same rules as C#) and there is no late binding. Unlike C#, the language is &lt;b&gt;not&lt;/b&gt; case-sensitive.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Contents&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#ArithmeticOperators"&gt;ArithmeticOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ComparisonOperators"&gt;ComparisonOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#AndOrXorNotOperators"&gt;AndOrXorNotOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ShiftOperators"&gt;ShiftOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Concatenation"&gt;Concatenation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Indexing"&gt;Indexing&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Literals"&gt;Literals&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Casting"&gt;Casting&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ConditionalOperator"&gt;ConditionalOperator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#InOperator"&gt;InOperator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#OverloadedOperatorsOnTypes"&gt;Overloaded Operators On Types&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;Arithmetic Operators&lt;/b&gt;&lt;a name="ArithmeticOperators"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports all the standard arithmetic operators as well as the modulo (%) and power (^) operators.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;a*2 + b ^ 2 - 100 % 5&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;ComparisonOperators&lt;/b&gt;&lt;a name="ComparisonOperators"&gt;&lt;/a&gt;&lt;br /&gt;All the comparison operators are supported as well.  The not equal operator is &lt;span class="codeInline"&gt;&amp;lt;&amp;gt;&lt;/span&gt; and the equal operator is &lt;span class="codeInline"&gt;=&lt;/span&gt;&lt;br /&gt;Example: &lt;span class="codeInline"&gt;a &amp;lt;&amp;gt; 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;And/Or/Xor/Not Operators&lt;/b&gt;&lt;a name="AndOrXorNotOperators"&gt;&lt;/a&gt;&lt;br /&gt;Flee uses these operators for both logical and bitwise operations.  Since the expression language is strongly-typed, Flee can determine the types of the operands to these operators.  If both operands are booleans, then the operation is logical.  If both are integral, the operation is bitwise.  Any other combination results in a compile error.&lt;br /&gt;Example (logical): &lt;span class="codeInline"&gt;a &amp;gt; 100 And Not b = 100&lt;/span&gt;&lt;br /&gt;Example (bitwise): &lt;span class="codeInline"&gt;(100 or 2) and 1&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Shift Operators&lt;/b&gt;&lt;a name="ShiftOperators"&gt;&lt;/a&gt;&lt;br /&gt;The left (&amp;lt;&amp;lt;) and right (&amp;gt;&amp;gt;) shift operators do a bitwise shift and are only valid on integral types.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;100 &amp;gt;&amp;gt; 2&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Concatenation&lt;/b&gt;&lt;a name="Concatenation"&gt;&lt;/a&gt;&lt;br /&gt;The + operator also serves as the string concatenation operator.  If either of its operands is a string, it will perform a concatenate instead of an addition.  It is valid for only one operand to be a string in which case, both operands are converted to Object and formatted accordingly.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;&amp;quot;abc&amp;quot; + &amp;quot;def&amp;quot;&lt;/span&gt;&lt;br /&gt;Example: &lt;span class="codeInline"&gt;&amp;quot;the number is: &amp;quot; + 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Indexing&lt;/b&gt;&lt;a name="Indexing"&gt;&lt;/a&gt;&lt;br /&gt;The indexing operator takes the form: &lt;span class="codeInline"&gt;member[indexExpression]&lt;/span&gt;.  Any expression can appear inside the brackets.  If the member being indexed is an array, Flee will emit optimized array element loading instructions.  If the indexed member has a default indexer property, flee will call the property with the evaluated index.  Indexing a type which is not an array and does not have a default indexer generates a compile exception.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;arr[i + 1] + 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Literals&lt;/b&gt;&lt;a name="Literals"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports the following literals in expressions:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Char&lt;/b&gt; - A character in single quotes: &lt;span class="codeInline"&gt;'a'&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Boolean&lt;/b&gt; - Either &lt;span class="codeInline"&gt;true&lt;/span&gt; or &lt;span class="codeInline"&gt;false&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Real&lt;/b&gt; - Any number with a decimal point is treated as a double-precision floating-point number.  Append a &amp;quot;f&amp;quot; to force the number to single-precision.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Integral&lt;/b&gt; - Any number without a decimal point.  Append &amp;quot;L&amp;quot; to force the number to a 64-bit integer and/or a &amp;quot;U&amp;quot; to force it to unsigned.  Flee will try to assign an integer literal to the first integral type that can contain the value.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Hex&lt;/b&gt; - Integral constants can also be specified in hex notation: &lt;span class="codeInline"&gt;0xFF12&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;String&lt;/b&gt; - String literals are enclosed in double quotes and escaping characters follows the same rules as C#: &lt;span class="codeInline"&gt;&amp;quot;string\u0021\r\n a \&amp;quot;new\&amp;quot; line&amp;quot;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Null&lt;/b&gt; - Using the keyword &lt;span class="codeInline"&gt;null&lt;/span&gt; will load the null reference into an expression.&lt;/li&gt;&lt;li&gt;&lt;b&gt;DateTime&lt;/b&gt; - A valid .NET DateTime pattern surrounded by #'s.  Use the &lt;span class="codeInline"&gt;ExpressionOptions.DateTimeFormat&lt;/span&gt; property to control the format.  Example:  &lt;span class="codeInline"&gt;#08/06/2008#.ToLongDateString()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;TimeSpan&lt;/b&gt; - A string in the format &lt;span class="codeInline"&gt;##[d.]hh:mm[:ss[.ff]]#&lt;/span&gt;.  Example: &lt;span class="codeInline"&gt;#08/06/2008# + ##1.23:45#&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;Casting&lt;/b&gt;&lt;a name="Casting"&gt;&lt;/a&gt;&lt;br /&gt;Casting is performed using the special cast function which takes the form &lt;span class="codeInline"&gt;cast(value, type)&lt;/span&gt;.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;100 + cast(obj, int)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Conditional Operator&lt;/b&gt;&lt;a name="ConditionalOperator"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports a conditional operator that allows you to pick a result based on a boolean condition.  It is implemented as a special function of the form &lt;span class="codeInline"&gt;if(condition, whenTrue, whenFalse)&lt;/span&gt;.  The operator is a &amp;quot;true&amp;quot; conditional operator: only the expression that matches the condition is evaluated.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;If(a &amp;gt; 100 and b &amp;gt; 10, &amp;quot;both greater&amp;quot;, &amp;quot;less&amp;quot;)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;In Operator&lt;/b&gt;&lt;a name="InOperator"&gt;&lt;/a&gt;&lt;br /&gt;The In operator is a boolean binary operator that returns true if its first operand is contained in its second operand.  It has two forms&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;List&lt;/b&gt;: Searches a list of values for a given value: &lt;span class="codeInline"&gt;value IN (value1, value2, value3,...)&lt;/span&gt;.  The value is compared against each value in the list and &lt;span class="codeInline"&gt;true&lt;/span&gt; is returned if the value is found, &lt;span class="codeInline"&gt;false&lt;/span&gt; if no match is found.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Collection&lt;/b&gt;: Searches a single collection for a given value: &lt;span class="codeInline"&gt;value IN collection&lt;/span&gt;.  The collection variable must implement &lt;span class="codeInline"&gt;ICollection&amp;lt;T&amp;gt;&lt;/span&gt;, &lt;span class="codeInline"&gt;IDictionary&amp;lt;K,V&amp;gt;&lt;/span&gt;, &lt;span class="codeInline"&gt;IList&lt;/span&gt;, or &lt;span class="codeInline"&gt;IDictionary&lt;/span&gt; for the expression to compile.  Arrays can be searched with this operator as they implement the first interface.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;Example (List): &lt;span class="codeInline"&gt;If(100 in (100, 200, 300, -1), &amp;quot;in&amp;quot;, &amp;quot;not in&amp;quot;)&lt;/span&gt;&lt;br /&gt;Example (Collection): &lt;span class="codeInline"&gt;if(100 in collection, &amp;quot;in&amp;quot;, &amp;quot;not in&amp;quot;)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Overloaded Operators On Types&lt;/b&gt;&lt;a name="OverloadedOperatorsOnTypes"&gt;&lt;/a&gt;&lt;br /&gt;When evaluating an arithmetic, comparison, or conversion operation where the operands are not primitives, Flee will look for and use any overloaded operators defined on the operands.  This means that you can create expressions such as &lt;span class="codeInline"&gt;a + b&lt;/span&gt; (where a and b are custom types), as long as there is an addition operator defined on either operand.&lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Thu, 12 Feb 2009 00:01:19 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LanguageReference 20090212120119A</guid></item><item><title>Updated Wiki: LanguageReference</title><link>http://www.codeplex.com/Flee/Wiki/View.aspx?title=LanguageReference&amp;version=27</link><description>&lt;div class="wikidoc"&gt;
&lt;b&gt;Language Reference&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;The expression language that Flee uses is a mix of elements of C# and VB.Net. Since the aim of this library is speed, the language is strongly typed (same rules as C#) and there is no late binding. Unlike C#, the language is &lt;b&gt;not&lt;/b&gt; case-sensitive.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Contents&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#ArithmeticOperators"&gt;ArithmeticOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ComparisonOperators"&gt;ComparisonOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#AndOrXorNotOperators"&gt;AndOrXorNotOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ShiftOperators"&gt;ShiftOperators&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Concatenation"&gt;Concatenation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Indexing"&gt;Indexing&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Literals"&gt;Literals&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Casting"&gt;Casting&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ConditionalOperator"&gt;ConditionalOperator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#InOperator"&gt;InOperator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#OverloadedOperatorsOnTypes"&gt;Overloaded Operators On Types&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;Arithmetic Operators&lt;/b&gt;&lt;a name="ArithmeticOperators"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports all the standard arithmetic operators as well as the modulo (%) and power (^) operators.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;a*2 + b ^ 2 - 100 % 5&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;ComparisonOperators&lt;/b&gt;&lt;a name="ComparisonOperators"&gt;&lt;/a&gt;&lt;br /&gt;All the comparison operators are supported as well.  The not equal operator is &lt;span class="codeInline"&gt;&amp;lt;&amp;gt;&lt;/span&gt; and the equal operator is &lt;span class="codeInline"&gt;=&lt;/span&gt;&lt;br /&gt;Example: &lt;span class="codeInline"&gt;a &amp;lt;&amp;gt; 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;And/Or/Xor/Not Operators&lt;/b&gt;&lt;a name="AndOrXorNotOperators"&gt;&lt;/a&gt;&lt;br /&gt;Flee uses these operators for both logical and bitwise operations.  Since the language is strongly-typed, Flee can determine the types of the operands to these operators.  If both operands are booleans, then the operation is logical.  If both are integral, the operation is bitwise.  Any other combination results in a compile error.&lt;br /&gt;Example (logical): &lt;span class="codeInline"&gt;a &amp;gt; 100 And Not b = 100&lt;/span&gt;&lt;br /&gt;Example (bitwise): &lt;span class="codeInline"&gt;(100 or 2) and 1&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Shift Operators&lt;/b&gt;&lt;a name="ShiftOperators"&gt;&lt;/a&gt;&lt;br /&gt;The left (&amp;lt;&amp;lt;) and right (&amp;gt;&amp;gt;) shift operators do a bitwise shift and are only valid on integral types.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;100 &amp;gt;&amp;gt; 2&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Concatenation&lt;/b&gt;&lt;a name="Concatenation"&gt;&lt;/a&gt;&lt;br /&gt;The + operator also serves as the string concatenation operator.  If either of its operands is a string, it will perform a concatenate instead of an addition.  It is valid for only one operand to be a string in which case, both operands are converted to Object and formatted accordingly.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;&amp;quot;abc&amp;quot; + &amp;quot;def&amp;quot;&lt;/span&gt;&lt;br /&gt;Example: &lt;span class="codeInline"&gt;&amp;quot;the number is: &amp;quot; + 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Indexing&lt;/b&gt;&lt;a name="Indexing"&gt;&lt;/a&gt;&lt;br /&gt;The indexing operator takes the form: &lt;span class="codeInline"&gt;member[indexExpression]&lt;/span&gt;.  Any expression can appear inside the brackets.  If the member being indexed is an array, Flee will emit optimized array element loading instructions.  If the indexed member has a default indexer property, flee will call the property with the evaluated index.  Indexing a type which is not an array and does not have a default indexer generates a compile exception.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;arr[i + 1] + 100&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Literals&lt;/b&gt;&lt;a name="Literals"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports the following literals in expressions:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Char&lt;/b&gt; - A character in single quotes: &lt;span class="codeInline"&gt;'a'&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Boolean&lt;/b&gt; - Either &lt;span class="codeInline"&gt;true&lt;/span&gt; or &lt;span class="codeInline"&gt;false&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Real&lt;/b&gt; - Any number with a decimal point is treated as a double-precision floating-point number.  Append a &amp;quot;f&amp;quot; to force the number to single-precision.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Integral&lt;/b&gt; - Any number without a decimal point.  Append &amp;quot;L&amp;quot; to force the number to a 64-bit integer and/or a &amp;quot;U&amp;quot; to force it to unsigned.  Flee will try to assign an integer literal to the first integral type that can contain the value.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Hex&lt;/b&gt; - Integral constants can also be specified in hex notation: &lt;span class="codeInline"&gt;0xFF12&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;String&lt;/b&gt; - String literals are enclosed in double quotes and escaping characters follows the same rules as C#: &lt;span class="codeInline"&gt;&amp;quot;string\u0021\r\n a \&amp;quot;new\&amp;quot; line&amp;quot;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Null&lt;/b&gt; - Using the keyword &lt;span class="codeInline"&gt;null&lt;/span&gt; will load the null reference into an expression.&lt;/li&gt;&lt;li&gt;&lt;b&gt;DateTime&lt;/b&gt; - A valid .NET DateTime pattern surrounded by #'s.  Use the &lt;span class="codeInline"&gt;ExpressionOptions.DateTimeFormat&lt;/span&gt; property to control the format.  Example:  &lt;span class="codeInline"&gt;#08/06/2008#.ToLongDateString()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;TimeSpan&lt;/b&gt; - A string in the format &lt;span class="codeInline"&gt;##[d.]hh:mm[:ss[.ff]]#&lt;/span&gt;.  Example: &lt;span class="codeInline"&gt;#08/06/2008# + ##1.23:45#&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;b&gt;Casting&lt;/b&gt;&lt;a name="Casting"&gt;&lt;/a&gt;&lt;br /&gt;Casting is performed using the special cast function which takes the form &lt;span class="codeInline"&gt;cast(value, type)&lt;/span&gt;.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;100 + cast(obj, int)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Conditional Operator&lt;/b&gt;&lt;a name="ConditionalOperator"&gt;&lt;/a&gt;&lt;br /&gt;Flee supports a conditional operator that allows you to pick a result based on a boolean condition.  It is implemented as a special function of the form &lt;span class="codeInline"&gt;if(condition, whenTrue, whenFalse)&lt;/span&gt;.  The operator is a &amp;quot;true&amp;quot; conditional operator; meaning it only evaluates the result that corresponds to the condition.&lt;br /&gt;Example: &lt;span class="codeInline"&gt;If(a &amp;gt; 100 and b &amp;gt; 10, &amp;quot;both greater&amp;quot;, &amp;quot;less&amp;quot;)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;In Operator&lt;/b&gt;&lt;a name="InOperator"&gt;&lt;/a&gt;&lt;br /&gt;The In operator is a boolean binary operator that returns true if its first operand is contained in its second operand.  It has two forms&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;List&lt;/b&gt;: Searches a list of values for a given value: &lt;span class="codeInline"&gt;value IN (value1, value2, value3,...)&lt;/span&gt;.  The value is compared against each value in the list and &lt;span class="codeInline"&gt;true&lt;/span&gt; is returned if the value is found, &lt;span class="codeInline"&gt;false&lt;/span&gt; if no match is found.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Collection&lt;/b&gt;: Searches a single collection for a given value: &lt;span class="codeInline"&gt;value IN collection&lt;/span&gt;.  The collection variable must implement &lt;span class="codeInline"&gt;ICollection&amp;lt;T&amp;gt;&lt;/span&gt;, &lt;span class="codeInline"&gt;IDictionary&amp;lt;K,V&amp;gt;&lt;/span&gt;, &lt;span class="codeInline"&gt;IList&lt;/span&gt;, or &lt;span class="codeInline"&gt;IDictionary&lt;/span&gt; for the expression to compile.  Arrays can be searched with this operator as they implement the first interface.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;Example (List): &lt;span class="codeInline"&gt;If(100 in (100, 200, 300, -1), &amp;quot;in&amp;quot;, &amp;quot;not in&amp;quot;)&lt;/span&gt;&lt;br /&gt;Example (Collection): &lt;span class="codeInline"&gt;if(100 in collection, &amp;quot;in&amp;quot;, &amp;quot;not in&amp;quot;)&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;Overloaded Operators On Types&lt;/b&gt;&lt;a name="OverloadedOperatorsOnTypes"&gt;&lt;/a&gt;&lt;br /&gt;When evaluating an arithmetic or comparison operation where the operands are not primitives, Flee will look for and use any overloaded operators defined on the operands.  This means that you can create expressions such as &lt;span class="codeInline"&gt;a + b&lt;/span&gt; (where a and b are custom types), as long as there is an addition operator defined on either operand.&lt;br /&gt;
&lt;/div&gt;</description><author>ECiloci</author><pubDate>Thu, 22 Jan 2009 03:30:34 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LanguageReference 20090122033034A</guid></item></channel></rss>