Implement versioning with grammars and functions

Save versions once they are successfully build and maybe also include a drafting mechanism

->this is related to use-orientation task in that separation of user-specific (draft) history might be required

(from redmine: issue id 316, created on 2018-01-22tgradl)