Implement generic memory reference parser.