The invention relates to a code construction method and
system for behavior rules, and relates to the technical field of
simulation modeling. A rule logic diagram corresponding to the target
behavior rule is obtained, the rule logic diagram comprises at least one component, each component is used for achieving at least one function in the target
behavior rule, and the components with the logic relation are connected through directed edges; performing conversion
processing on the rule logic diagram by utilizing a set conversion tool to obtain an intermediate representation diagram with a
set representation form; performing analysis
processing on the intermediate representation graph to identify components included in the intermediate representation graph and a
logical relationship between the identified components; acquiring a component code of the identified component; and combining the obtained component codes according to the logic relationship between the identified components, and constructing to obtain the code of the target
behavior rule. The
information loss is reduced, and flexible expansion of different logic representations and different code platforms can be supported by means of the logic intermediate representation graph.