public function getAst(Node\Node $b, $path = '')
    {
        $ret = array(
            'type' => str_replace('Zicht\Tool\Script\Node\\', '', get_class($b))
        );
        if ($b instanceof Node\Branch) {
            if (count($b->nodes)) {
                $ret['nodes'] = array();

                foreach ($b->nodes as $n) {
                    if (null === $n) {
                        $ret['nodes'][] = $n;
                    } else {
                        if (!$n instanceof Node\Node) {
                            throw new \InvalidArgumentException("Invalid child node in " . Util::toPhp($path));
                        }
                        $ret['nodes'][] = $this->getAst($n);
                    }
                }
            }
        }

        return $ret;
    }