protected function transpileNodes(AbstractSyntaxTree $ast) : string
    {
        $transpiledView = '';
        $rootNode = $ast->getRootNode();
        $previousNodeWasExpression = false;

        foreach ($rootNode->getChildren() as $childNode) {
            switch (get_class($childNode)) {
                case DirectiveNode::class:
                    $transpiledView .= $this->transpileDirectiveNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case SanitizedTagNode::class:
                    $transpiledView .= $this->transpileSanitizedTagNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case UnsanitizedTagNode::class:
                    $transpiledView .= $this->transpileUnsanitizedTagNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case CommentNode::class:
                    $transpiledView .= $this->transpileCommentNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case ExpressionNode::class:
                    // To keep expressions from running against each other, we pad all expressions but the first
                    if ($previousNodeWasExpression) {
                        $transpiledView .= ' ';
                    }

                    $transpiledView .= $this->transpileExpressionNode($childNode);
                    $previousNodeWasExpression = true;

                    break;
                default:
                    throw new RuntimeException(
                        sprintf(
                            'Unknown node class %s',
                            get_class($childNode)
                        )
                    );
            }
        }

        return $transpiledView;
    }