grammar selector implemented