Automatons and grammar lecture notes