Context-free grammars for triangular arrays