Use grappa as parser framework and fixed several bugs.

Change-Id: Ie15ade5fcb74223c00b694064db3d9c9e3be4d01