basic grammar implementation