Reimplemented loop matching to allow state restoration after mismatch.
Modified the API to match the reference project.
Shared data accessible in Grammer Code via "this" instead of "env".
Added destructor functionality.