Extracting and Learning an Unknown Grammar with Recurrent Neural Networks