code for add a rule and part of the interpreter for code generation