# How to represent software code for code generation / automatic programming? How to integrate procedural and declarative knowledge?

I am learning about deontic logics and there I can make the following inferences: If A then there is **duty to create an entity of class C**, If B then there is **duty to assign value 5 to the attribute c.a**, if A and B then **the computation D should be executed**. I. e. those deontic logic statements contain the usual propositional variables A, B, C, but they also contain actions - pieces of procedural knowledge, like create an entity of class C and so on. The questions are:

• How do I represent those actions in such manner that they can be used for the code generation/automatic programming? The simple approach can be to represent them by their content - e.g. by the code in the industrial programming language.
• The goal of such reasoning is to create the syntactical tree of the program from which the source code in the industrial programming language can be read as source file. How do I represent actions that they can form the syntactical tree?

I feel that the deontic logic (formalized norms) are enough for generating software code (at least business layer - classes and their behavior), but I am struggling with the consequent end of the inference - how to represent actions/source code?

This may be seen as the more general question as well: formalized norms can be seen as the declarative knowledge and we should create reactive, procedural programs / procedural knowledge from the declarative knowledge - how to represent procedural knowledge and how to create procedural knowledge from the declarative knowledge? Are there research efforts to do this and what are keywords for this type of reasearch (so - I can find the already achieved results in Google or journal databases).

• There is promising book Automatic Program Development springer.com/us/book/9781402065842 in which one article descibes APTS (Abstract Program Transformation System) - system that generates software code from the formal specification. Maybe it is the way to go... – TomR Dec 13 '16 at 21:52
• Maybe this is not trending and I should look for program transformation: there is no generation, there is transformation! – TomR Dec 13 '16 at 22:27