adapted c parser