Generating comments for code generated from a model
AssigneeThe MathWorks, Inc.
InventorAndrew C Bartlett
Life of this patent
Estimating the term…
Abstract
In an embodiment, a technique for generating a comment for an entity associated with a model. The comment may be generated based on at least (1) a structural usage of the entity and (2) a dynamically-specified rule that is associated with the structural usage of the entity. The rule may be used to control content of the comment. The comment may be incorporated in generated code for the model and the generated code including the comment may be outputted (e.g., displayed, stored).
Claims30
A non-transitory computer-readable medium that stores computer-executable instructions, the instructions comprising:
- one or more instructions which, when executed by a processor, cause the processor to:
- generate a representation of a model,
- the model including a plurality of nodes;
- generate code based on the generated representation of the model;
- generate a comment associated with at least one of the plurality of nodes included in the model,
- the comment being generated based on at least:
- a structural usage of a node, of the plurality of nodes, associated with the model, and
- a rule that is associated with the structural usage of the node;
- determine whether the generated comment should be included in the generated code;
- and
- provide, when the generated comment should be included in the generated code, the generated code and the generated comment.
A method comprising:
- generating a representation of a model,
- the model including a plurality of nodes, and
- the generating being performed by a computing device;
- generating code based on the generated representation of the model,
- the generating the code being performed by the computing device;
- acquiring a rule that is associated with at least one of the plurality of nodes,
- the acquiring being performed by the computing device;
- generating a comment associated with the at least one of the plurality of nodes, the comment being generated based on at least:
- a structural usage of a node, of the at least one of the plurality of nodes associated with the model, and
- the rule,
- the generating the comment being performed by the computing device;
- determining whether the generated comment should be included in the generated code, the determining being performed by the computing device;
- and
- providing, when the generated comment should be included in the generated code, the generated code and the generated comment,
- the providing being performed by the computing device.
A system comprising:
- a device to:
- generate a representation of a model,
- the model including a plurality of nodes;
- generate code based on the generated representation of the model;
- generate a comment associated with at least one of the plurality of nodes included in the model, the comment being generated based on at least:
- a structural usage of a node, of the plurality of nodes, associated with the model, and
- a rule that is associated with the structural usage of the node;
- determine whether the generated comment should be included in the generated code;
- and
- provide, when the generated comment should be included in the generated code, the generated code and the generated comment.
A device comprising:
- a memory storing instructions;
- and
- a processor to execute the instructions to:
- generate a representation of a model,
- the model including a plurality of nodes;
- generate code based on the generated representation of the model;
- generate a comment associated with at least one of the plurality of nodes included in the model, the comment being generated based on at least:
- a structural usage of a node, of the plurality of nodes, associated with the model, and
- a rule that is associated with the structural usage of the node;
- determine whether the generated comment should be included in the generated code;
- and
- provide, when the generated comment should be included in the generated code, the generated code and the generated comment.
Dependencies are inferred from the claim text.