public function compile($input, $path = null)
    {

        //Compiler reset
        $this->files = $path ? [$path] : [];
        $this->mixins = [];
        $this->calledMixins = [];
        $this->blocks = [];
        $this->level = 0;
        $this->iteratorId = 0;
        $this->forceInline = false;

        //Parse the input into an AST
        $node = null;
        try {

            $node = $this->parser->parse($input);
        } catch(\Exception $e) {

            //This is needed to be able to keep track of the
            //file path that is erroring
            if (!($e instanceof Exception))
                $this->throwException($e->getMessage());
            else throw $e;
        }

        //There are some things we need to take care of before compilation
        $this->handleImports($node);
        $this->handleBlocks($node);
        $this->handleMixins($node);

        //The actual compilation process ($node is the very root \Tale\Pug\Parser\Node of everything)
        $phtml = $this->compileNode($node);


        //Reset the level again for our next operations
        $this->level = 0;
        //Now we append/prepend specific stuff (like mixin functions and helpers)
        $mixins = $this->compileMixins();

        $helpers = '';
        if ($this->options['stand_alone']) {

            $helpers = file_get_contents(__DIR__.'/Compiler/functions.php')."\n?>\n";
            $helpers .= $this->createCode('namespace {');
        }

        //Put everything together
        $phtml = implode('', [$helpers, $mixins, $phtml]);

        if ($this->options['stand_alone'])
            $phtml .= $this->createCode('}');

        //Reset the files after compilation so that compileFile may resolve correctly
        //Happens when you call compileFile twice on different files
        //Note that Compiler only uses the include-path, when there is no file in the
        //file name storage $_files
        $this->files = [];

        //Return the compiled PHTML
        return trim($phtml);
    }