Method of providing interactive usage descriptions based on source code analysis
First Claim
1. A method comprising:
- creating, by a processor, a parse tree data structure for a function written in a computer programming language,the function specifying;
one or more input arguments,one or more output arguments, andone or more operations,the parse tree data structure including nodes, at least some of the nodes of the parse tree data structure corresponding to;
the one or more input arguments,the one or more output arguments, andthe one or more operations of the function,where the creating the parse tree data structure includes assigning one or more conditions to a first node of the parse tree data structure;
storing the parse tree data structure in a memory coupled to the processor;
identifying, within a program being created, a call to the function;
mapping portions of the call to the function to one or more of the nodes of the parse tree data structure;
analyzing, by the processor, the parse tree data structure with the portions of the call to the function mapped to the one or more of the nodes of the parse tree data structure, where the analyzing includesperforming a tree walk of the parse tree data structure, andutilizing information from the function call of the program being created to evaluate the one or more conditions assigned to the first node of the parse tree data structure;
producing, by the processor, based on the analyzing;
a usage hint for completing the call to the function, ora validation message of the call to the function; and
presenting, by the processor, the usage hint or the validation message.
1 Assignment
0 Petitions
Accused Products
Abstract
A method of dynamically analyzing source code for generating usage hints while editing the source code is disclosed. A parse tree data structure is generated for each function called. The incoming and outgoing arguments in the parse tree are identified. A user calls the function by entering arguments as part of the function-call. The user'"'"'s input arguments are associated with the corresponding argument in the parse tree. Relevant preconditions and post-conditions of the nodes surrounding the current location in the parse tree are analyzed to provide usage hints for the completion of the function call. In the case of a completed function call argument entered by the user, the type and number of arguments in the completed function call are compared to the required type and number of arguments of the function to validate the function call. Error messages are provided in the event of an invalid call.
-
Citations
36 Claims
-
1. A method comprising:
-
creating, by a processor, a parse tree data structure for a function written in a computer programming language, the function specifying; one or more input arguments, one or more output arguments, and one or more operations, the parse tree data structure including nodes, at least some of the nodes of the parse tree data structure corresponding to; the one or more input arguments, the one or more output arguments, and the one or more operations of the function, where the creating the parse tree data structure includes assigning one or more conditions to a first node of the parse tree data structure; storing the parse tree data structure in a memory coupled to the processor; identifying, within a program being created, a call to the function; mapping portions of the call to the function to one or more of the nodes of the parse tree data structure; analyzing, by the processor, the parse tree data structure with the portions of the call to the function mapped to the one or more of the nodes of the parse tree data structure, where the analyzing includes performing a tree walk of the parse tree data structure, and utilizing information from the function call of the program being created to evaluate the one or more conditions assigned to the first node of the parse tree data structure; producing, by the processor, based on the analyzing; a usage hint for completing the call to the function, or a validation message of the call to the function; and presenting, by the processor, the usage hint or the validation message. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
-
-
13. A non-transitory computer-readable medium comprising program instructions for execution by a processor, the program instructions instructing the processor to:
-
create a parse tree data structure for a function written in a computer programming language, the function specifying; one or more input arguments, one or more output arguments, and one or more operations, the parse tree data structure including nodes, at least some of the nodes of the parse tree data structure corresponding to; the one or more input arguments, the one or more output arguments, and the one or more operations of the function, where the instructions to create the parse tree data structure include instructions to assign one or more conditions to a first node of the parse tree data structure; store the parse tree data structure in a memory coupled to the processor; identify, within a program being created, a call to the function; map portions of the call to the function to one or more of the nodes of the parse tree data structure; analyze the parse tree data structure with the portions of the call to the function mapped to the one or more of the nodes of the parse tree data structure, where the analyzing includes performing a tree walk of the parse tree data structure, and utilizing information from the function call of the program being created to evaluate the one or more conditions assigned to the first node of the parse tree data structure; produce based on the analyzing; a usage hint for completing the call to the function, or a validation message of the call to the function; and present the usage hint or the validation message. - View Dependent Claims (14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)
-
-
25. An apparatus comprising:
-
a memory storing a parse tree data structure for a function written in a computer programming language, the function specifying; one or more input arguments, one or more output arguments, and one or more operations, the parse tree data structure including nodes, at least some of the nodes of the parse tree data structure corresponding to; the one or more input arguments, the one or more output arguments, and the one or more operations of the function, where one or more conditions are assigned to a first node of the parse tree data structure; and a processor configured to identify a call to the function, map portions of the call to the function to one or more of the nodes of the parse tree data structure, analyze the parse tree data structure with the portions of the call to the function mapped to the one or more of the nodes of the parse tree data structure, the analyze including performing a tree walk, and utilizing information from the function call to evaluate the one or more conditions assigned to the first node of the parse tree data structure, based on the analyze, produce; a usage hint for completing the call to the function, or a validation message of the call to the function; and present the usage hint or the validation message. - View Dependent Claims (26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36)
-
Specification