moved input and output grammar instanciation to factory