IP Library Granted Patent US 10,216,611
Granted Patent B2
US 10,216,611 · App. 15/593,292 · Granted Feb 26, 2019

Detecting mistyped identifiers and suggesting corrections using other program identifiers

Inventor: Peter Dillinger (Seattle, WA)
Assignee: Synopsys, Inc.
G06F11/3624G06F8/75G06F11/3644
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,216,611
App. No.
15/593,292
Granted
Feb 26, 2019
Kind
B2
Abstract

A code testing system determines mistyped identifiers in computer language code. For identifiers of objects in the code, such as variables and functions, the instances of the identifiers are identified in the code and recorded in an occurrence table. Uses of an identifier may be identified as copies of one another based on a hash value of the instance and its location in a function. Hash values for an identifier that are not unique may not be recorded in the instance table. For identifiers that are associated with a single occurrence or a single group of copies, these identifiers are identified as candidates for correction. Suggested corrections are determined based on a comparison with other identifiers in the occurrence table to determine similar identifiers in the occurrence table. If so, the candidate identifier may be identified as likely mistyped and the similar identifier is suggested as a correction.

Claims (42)

1. A method for suggesting corrections to in computer code prior to execution by a computer comprising:

identifying, by a computer system, a set of functions in computer code in a programming language, the programming language of the computer code permitting usage of identifiers without static resolution;

generating, by the computer system, an occurrence table of each identifier in the computer code, the occurrence table identifying instances of each identifier in the computer code;

identifying, by the computer system, a set of candidate identifiers from the identifiers in the occurrence table that have fewer instances in the occurrence table than a threshold, wherein each candidate identifier in the set of candidate identifiers is a possible mistyped identifier;

for each candidate identifier in the set of candidate identifiers, identifying, by the computer system, a set of similar identifiers in the occurrence table;

identifying, by the computer system, a correction for the candidate identifiers in the set of candidate identifiers based on the set of similar identifiers;

suggesting, on a user interface to a user, the correction for the candidate identifier in the set of candidate identifiers to modify the computer code; and

providing a control for applying the correction to modify the candidate identifiers in the computer code in response to a user command.

2. The method of claim 1 , wherein generating an occurrence table for each identifier includes determining, for each use of each identifier in the computer code, a function containing each identifier, and a position of each identifier in the function.

3. The method of claim 2 , wherein determining the position of each identifier in the function is based on an abstract syntax tree of the function containing each identifier.

4. The method of claim 3 , wherein determining the position of each identifier in the function is based on a depth-first post-order traversal of the abstract syntax tree.

5. The method of claim 2 , wherein generating the occurrence table comprises: determining, by the computer system, for each use of each identifier in the computer code, a hash value based on each identifier and a position of each identifier in a function; and identifying, by the computer system, instances of each identifier for each unique hash value of each identifier.

6. The method of claim 1 , wherein the correction for at least one candidate identifier of the set of candidate identifiers is identified in the set of similar identifiers and occurs in the occurrence table more than the at least one candidate identifier.

7. The method of claim 6 , wherein the correction for the at least one candidate identifier is identified based on a threshold number of instances of the similar identifiers, the threshold number varying based on a type of typographical difference between the at least one candidate identifier and the similar identifiers.

8. A non-transitory computer-readable medium for suggesting candidate correction to computer code prior to execution by a computer, the computer-readable medium comprising instructions executable by a processor to perform:

identifying a set of functions in computer code in a programming language, the programming language of the computer code permitting usage of identifiers without static resolution;

generating an occurrence table of each identifier in the computer code, the occurrence table identifying instances of each identifier in the computer code;

identifying a set of candidate identifiers from the identifiers in the occurrence table that have fewer instances in the occurrence table than a threshold, wherein each candidate identifier in the set of candidate identifiers is a possible mistyped identifier; for each candidate identifier in the set of candidate identifiers, identifying a set of similar identifiers in the occurrence table;

identifying a correction for the candidate identifiers in the set of candidate identifiers based on the set of similar identifiers;

suggesting, on a user interface to a user, the correction for the candidate identifier in the set of candidate identifiers to modify the computer code; and

providing a control for applying the correction to modify the candidate identifiers in the computer code in response to a user command.

9. The computer-readable medium of claim 8 , wherein generating an occurrence table for each identifier includes determining, for each use of each identifier in the computer code, a function containing each identifier, and a position of each identifier in the function.

10. The computer-readable medium of claim 8 , wherein determining the position of each identifier in the function is based on an abstract syntax tree of the function containing each identifier.

11. The computer-readable medium of claim 10 , wherein determining the position of each identifier in the function is based on a depth-first post-order traversal of the abstract syntax tree.

12. The computer-readable medium of claim 9 , wherein generating the occurrence table comprises: determining, for each use of each identifier in the computer code, a hash value based on each identifier and a position of each identifier in a function; and identifying instances of each identifier for each unique hash value of each identifier.

13. The computer-readable medium of claim 8 , wherein the correction for at least one candidate identifier of the set of candidate identifiers is identified in the set of similar identifiers and occurs in the occurrence table more than the at least one candidate identifier.

14. The computer-readable medium of claim 13 , wherein the correction for the at least one candidate identifier is identified based on a threshold number of instances of the similar identifiers, the threshold number varying based on a type of typographical difference between the at least one candidate identifier and the similar identifiers.

15. A system for detecting errors in computer code prior to execution by a computer comprising:

a processor; and

a non-transitory computer-readable medium comprising instructions executable by a processor to perform:

identifying a set of functions in computer code in a programming language, the programming language of the computer code permitting usage of identifiers without static resolution;

generating an occurrence table of each identifier in the computer code, the occurrence table identifying instances of each identifier in the computer code;

identifying a set of candidate identifiers from the identifiers in the occurrence table that have fewer instances in the occurrence table than a threshold, wherein each candidate identifier in the set of candidate identifiers is a possible mistyped identifier;

for each candidate identifier in the set of candidate identifiers, identifying a set of similar identifiers in the occurrence table;

identifying a correction for the candidate identifiers in the set of candidate identifiers based on the set of similar identifiers;

suggesting, on a user interface to a user, the correction for the candidate identifier in the set of candidate identifiers to modify the computer code; and

providing a control for applying the correction to modify the candidate identifiers in the computer code in response to a user command.

16. The system of claim 15 , wherein generating an occurrence table for each identifier includes determining, for each use of each identifier in the computer code, a function containing each identifier, and a position of each identifier in the function.

17. The system of claim 16 , wherein determining the position of each identifier in the function is based on an abstract syntax tree of the function containing each identifier.

18. The system of claim 17 , wherein determining the position of each identifier in the function is based on a depth-first post-order traversal of the abstract syntax tree.

19. The system of claim 18 , wherein generating the occurrence table comprises: determining, for each use of each identifier in the computer code, a hash value based on each identifier and a position of each identifier in a function; and identifying instances of each identifier for each unique hash value of each identifier.

20. The system of claim 18 , wherein the correction for at least one candidate identifier of the set of candidate identifiers is identified in the set of similar identifiers and occurs in the occurrence table more than the at least one candidate identifier.

Assignments (4)
SECURITY INTEREST Recorded Sep 30, 2024
From: BLACK DUCK SOFTWARE, INC.
To: ARES CAPITAL CORPORATION, AS COLLATERAL AGENT
Reel/Frame 069083/0149 →
CHANGE OF NAME Recorded Jul 30, 2024
From: SOFTWARE INTEGRITY GROUP, INC.
To: BLACK DUCK SOFTWARE, INC.
Reel/Frame 068191/0490 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 23, 2024
From: SYNOPSYS, INC.
To: SOFTWARE INTEGRITY GROUP, INC.
Reel/Frame 066664/0821 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 29, 2017
From: DILLINGER, PETER
To: SYNOPSYS, INC.
Reel/Frame 042521/0611 →
Continuity (2)
Provisional Application 62334981 · May 11, 2016
Related Publication 20170329697A1 · Nov 16, 2017
Cited By (1)
US 12,355,795