title: C interpreter written in javascript
body: <p>Is there any C interpreter written in javascript or java ?</p>
  
  <p>I don't need a full interpreter but I need to be able to do a step by step execution of the program and being able to see the values of variables, the stack...all that in a web interface.</p>
  
  <p>The idea is to help C beginners by showing them the step by step execution of the program.
  We are using GWT to build the interface so if something exists in Java we should be able to use it.</p>
  
  <p>I can modify it to suit my needs but if I can avoid to write the parser / abstract-syntax tree walker / stack manipulation... that would be great.</p>
  
  <p><hr>
  <strong>Edit :</strong></p>
  
  <p>To be clear I don't want to simulate the complete C because some programs can be really tricky.</p>
  
  <p>By step I mean a basic operation such as : expression evaluation, affectation, function call.</p>
  
  <p>The C I want to simulate will contains : variables, for, while, functions, arrays, pointers, maths functions.
  No goto, string functions, ctypes.h, setjmp.h... (at least for now).</p>
  
  <p>Here is a prototype : <a href="http://www.di.ens.fr/~fevrier/war/simu.html">http://www.di.ens.fr/~fevrier/war/simu.html</a></p>
  
  <p>In this example we have manually converted the C code to a javascript representation but it's limited (expressions such as <code>a == 2 || a = 1</code> are not handled) and is limited to programs manually converted.</p>
  
  <p>We have a our disposal a C compiler on a remote server so we can check if the code is correct (and doesn't have any undefined behavior). The parsing / AST construction can also be done remotely (so any language) but the AST walking needs to be in javascript in order to run on the client side.</p>