title: How to add symbols into a parsed AST?
body: <p>(This is loosely related to <a href="https://stackoverflow.com/questions/29373551/scala-script-in-2-11">Scala script in 2.11</a> and <a href="https://stackoverflow.com/questions/12122939/generating-a-class-from-string-and-instantiating-it-in-scala-2-10">Generating a class from string and instantiating it in Scala 2.10</a>).</p>
  
  <p>In the code below I have a code parsed runtime using Toolbox into a corresponding AST. How can add symbol definitions (<code>prefix</code> in the code below) to the AST so that those symbols can be used in the expression tree?</p>
  
  <pre><code>import scala.reflect.runtime.universe._
  import scala.tools.reflect.ToolBox
  
  object Main extends App {
  
    val cm = runtimeMirror(getClass.getClassLoader)
    val tb = cm.mkToolBox()
  
    val expr = tb.parse("println(i)")
  
    val build = internal.reificationSupport
  
    val prefix = build.setInfo(build.newFreeTerm("i", 2), typeOf[Int])
  
    // TODO: add prefix before expr by some AST manipulation
  
    tb.eval(expr)
  }
  </code></pre>