dclass: Update lexer and parser defs. Move all the file writing code to write.h, write.cpp