Grammar replicator implemented and working, but decoding isn't fully incremental and the code is a huge mess