If your parser doesn't have to be too general (i.e. the examples there are all the things it has to cope with) and I didn't fancy messing about with a parser generator I'd do something like:
while( lines_to_read )
read a line
remove the terminating semi-colon
has the line got an '=' in it?
yes: it's an assignment
split line into two at the '=' character
no: it's a declaration
split line into two at the first white space character
trim whitespace from each substring
form output string