initial parser code for #4 with some dispatch depending on attribute 'type'