implemented macro for parsers definition and generic dispatch function

resolve ticket #2