title: Cross language simple expression language implementation
body: <p>Does there exist a very simple expression language that has parsers in one of the following languages:</p>
  
  <ul>
  <li>JavaScript</li>
  <li>Scala</li>
  <li>Java</li>
  </ul>
  
  <p>The operations I want to perform on objects are similar to angular expressions. <a href="http://teropa.info/blog/2014/03/23/angularjs-expressions-cheatsheet.html" rel="nofollow">http://teropa.info/blog/2014/03/23/angularjs-expressions-cheatsheet.html</a> </p>
  
  <p>However I do not require all of them, since I want language independent functionality. The object exposed to the expression should be JSON. Meaning I don't need to allow for function calls for instance. Filter functionality isn't needed either.</p>
  
  <p>What I want to use this for is for simple validation expressions shared between language implementations.</p>
  
  <p>Given the following person</p>
  
  <pre><code>{
      age: 17,
      male: false,
      country: 'US'
  }
  </code></pre>
  
  <p>I would maybe want to define validation rules like this </p>
  
  <pre><code>{
      age: "(male &amp;&amp; age &gt;= 16) || (!male &amp;&amp; age &gt;= 18)", // =&gt; conditionally valid
      country: "country == 'US'" // =&gt; valid
  }
  </code></pre>
  
  <p>What alternatives do I have for simple expressions like this that should return true or false? The operators does not need to be as in the examples above. <code>and</code> is fine instead of <code>&amp;&amp;</code> or <code>lt</code> is fine instead of <code>&lt;</code> etc.</p>
  
  <p>I have seen some alternatives like <a href="http://docs.oracle.com/javaee/7/tutorial/doc/jsf-el007.htm#BNAIM" rel="nofollow">http://docs.oracle.com/javaee/7/tutorial/doc/jsf-el007.htm#BNAIM</a> but the problems with those that I have seen is that they are meant for use in a specific context and have several implicit variables. And they have things like lambda expressions etc. which makes writing possible missing implementation in a language much more complex.</p>