title: scripting language - to execute on the server
body: <p>I'm looking for a scripting language that would be:</p>
  
  <ol>
  <li>a scripting language that is embeddable in Java
  <ul>
  <li>actually I mean something that will not be executed as a native code, but interpreted</li>
  </ul></li>
  <li>secure (users would upload their scripts which would then execute on the server)
  <ul>
  <li>no access to anything outside some 'sandbox', no access to threads, I/O, etc. </li>
  <li>Just flow control + algorithms/data structures (maybe some predefined "classes", like collections) + interaction with explicitly provided API</li>
  </ul></li>
  <li>it would be possible to limit execution time per script (n seconds or n instructions)
  <ul>
  <li>it is possible if the language is interpreted. For example: replace each instruction with "check if I should execute the next instruction and execute it or quit"</li>
  </ul></li>
  <li>have simple and readable syntax</li>
  </ol>
  
  <p>The ultimate goal is to be able to run untrusted code which should only be able to use provided API, without breaking anything (like entering infinite loops / consuming too much resources / accessing anything except provided API)</p>
  
  <p>Is there some existing language that I could use?</p>