A domain-specific language (DSL) is a programming language that is specialized to a particular application domain. IRON is a DSL for the IoT domain which allows not only to program in an easy way using the Event-Condition-Action (ECA) rules but also to prevent incorrect actions. In this paper, we formally describe the semantics of IRON. The anomalies that IRON prevents are: (i) the presence of cycles that determine the nontermination, (ii) the ambiguous actions that do not allow the definition of a final configuration, (iii) the breaking of invariances. In addition to the formal description of IRON, an interpreter was created in a host language (LUA) that captures and manages the three anomalies. This provides a general scheme for the implementation of languages based on ECA rules.