code: @Override
      public CompiledScript compile(String script) throws ScriptException {
          try {
              final PreparsedScript preparsed = new PreparsedScript(script);
              return new CompiledScript() {
  
                  @Override
                  public Object eval(ScriptContext context) throws ScriptException {
                      try {
                          preparsed.setOut(toPrintStream(context.getWriter()));
                          preparsed.setErr(toPrintStream(context.getErrorWriter()));
                          return preparsed.invoke(new ScriptContextEngineView(context));
                      } catch (final UnsupportedEncodingException e) {
                          throw new ScriptException(e.toString(), script, -1);
                      } catch (final EvalError e) {
                          throw constructScriptException(e);
                      }
                  }
  
                  @Override
                  public ScriptEngine getEngine() {
                      return BshScriptEngine.this;
                  }
  
              };
          } catch (final EvalError e) {
              throw constructScriptException(e);
          }
      }
docs: Compiles the script (source represented as a {@code String}) for later
  execution.
  
  @param script The source of the script, represented as a {@code String}.
  @return An subclass of {@code CompiledScript} to be executed later
  using one of the {@code eval} methods of {@code CompiledScript}.
  @throws ScriptException    if compilation fails.
  @throws NullPointerException if the argument is null.