refactoring to use some language's parser patterns