Parse AVS

WIP. @timtait's approach is much simpler.