implemented stateful low-level parser