Context-free grammars and nonnegative matrices