simple grammar analyzer