generator: add Buffer class that deals with the actual code output