Consider the language generated by the following context free grammar: 
$$
S \to SS \quad S \to () \quad S \to (S) \quad S \to [] \quad S \to [S]
$$
There is a one-to-one correspondence between this language and rooted planar trees where each edge is either dashed or solid ([] corresponds to a dashed edge and () corresponds to a solid edge). Call a tree $T$ *good* if when you remove all the solid edges, the remaining dashed forest is a connected tree where all the vertices have valence $ \leq 2 $ (i.e a path). Let $L$ be the sublanguage consisting of all good trees. 



> 
>  **Question:**  is $L$ context free?
> 
> 
> 


It is easy to check that $L$ satisfies the pumping lemma for context free languages. My instincts tell me that it shouldn't be context free because you can only add square brackets (which correspond to dashed edges) in certain contexts, but I don't know if this intuition can be turned into a proof. 



Is this variant of the balanced bracket language context free?
I think it's context-free and generated by roughly speaking the following 7 rules (but see Harry Altman's answer for more precision)
$$S \rightarrow TUT,\quad U\rightarrow [TUT]$$
$$ U\rightarrow e,\quad T\rightarrow e$$
$$T\rightarrow (T)$$
$$T\rightarrow TT,\quad T\rightarrow ()$$
Here $S$ is the start symbol, $T$ represents an expression using (,) parentheses, $U$ builds up the [,] part, and $e$ is the empty string.


