title: Can I get AST from live scala code?
body: <p>I said "live code" because I mean not from text source files or source strings, but from partialFunctions / lambdas. (I know Ruby1.8's parseTree and C# linq can do it)</p>
  
  <p>consider a partialFunction f:</p>
  
  <pre><code>val f = (i: Int, j: Int) =&gt; (i + j) * 2
  </code></pre>
  
  <p>I hope there is some tool works like this:</p>
  
  <pre><code>getBodyAstFrom(f) //=&gt; (Infix('*'), (Infix('+'), Id('i'), Id('j')), Val('2'))
  </code></pre>
  
  <p>I don't care the semantic things (context parsing and implicits are too complex, and unnecessary for me), I just need the syntax tree from live code, is it possible?</p>
  
  <p>There may be issues with inspecting other people's code, but what about my own code? Is the following things possible?</p>
  
  <pre><code>val f = AstFunction(i: Int, j: Int){(i + j) * 2}
  f(5, 6) //=&gt; 22
  f.ast   //=&gt; (Infix('*'), (Infix('+'), Id('i'), Id('j')), Val('2'))
  </code></pre>
  
  <p>It seems to need some hacking into the compiler, hmmmm...</p>