Implement code generation for nary operators, make 'AN' in binary and nary operators optional, some refactoring