grammar: define parser state class

Signed-off-by: Peter Williams <pwil3058@gmail.com>