Using big code to construct code conditional truth tables

US11656869B2 · US · B2

Patent metadata
FieldValue
Publication numberUS-11656869-B2
Application numberUS-202117526760-A
CountryUS
Kind codeB2
Filing dateNov 15, 2021
Priority dateApr 7, 2020
Publication dateMay 23, 2023
Grant dateMay 23, 2023

How to read this patent

A practical reading order for non-experts. Skip the full description unless you need deep technical detail.

  1. Title

    What the patent document calls the invention.

  2. Abstract

    A short plain-language summary of the technical disclosure.

  3. Assignees and inventors

    Who owns or filed the patent and who is credited as inventor.

  4. Key dates

    Filing, priority, publication, and grant dates set the timeline.

  5. First independent claim

    The legal scope of protection — read this for what is actually claimed.

  6. CPC / IPC classifications

    Technology tags used to group this patent with similar filings.

  7. Citations and related patents

    Prior art links and similar publications in this corpus.

Abstract

Official abstract text for this publication.

A method of analyzing code is provided. The method includes generating an abstract representation of the code, identifying conditional statements in the abstract representation, populating a truth table for each conditional statement that has been identified with all possible outcomes of the conditional statement and assessing the truth table for each conditional statement to identify issues.

First claim

Opening claim text (preview).

What is claimed is: 1. A method of analyzing redundancies in code with multiple programmers responsible for generating the code, the method comprising: receiving sections of the code from a first portion of each of the multiple programmers in parallel and from a second portion of each of the multiple programmers in series; and executing a method of analyzing the code by: generating an abstract representation of the code; identifying conditional statements in the abstract representation; populating a truth table for each conditional statement that has been identified with all possible outcomes of the conditional statement; assessing the truth table for each conditional statement to identify instances in which unreachable code regions, defined as those regions of the code that will never run based on a logical construction of earlier and later conditional statements, are present in the code; and issuing signals comprising proposed changes to the code to address and correct the instances separately to the first portion and the second portion of each of the multiple programmers. 2. The method according to claim 1 , wherein the generating of the abstract representation comprises: parsing the code to generate tokens; representing the tokens in a concrete representation; and replacing the tokens with abstract terms in the concrete representation to create the abstract representation. 3. The method according to claim 2 , wherein each token comprises a language-specific token and each abstract term comprises a generic value. 4. The method according to claim 2 , wherein the replacing of the tokens with the abstract terms comprises traversing the concrete representation in an order of instructions of the stream of the code. 5. The method according to claim 1 , wherein each conditional statement comprises one or more of an if-else statement, a select statement, a switch statement and a ternary operator. 6. The method according to claim 1 , wherein the identifying of the conditional statements in the abstract representation comprises traversing the abstract representation in an order of instructions of the code, the populating of the truth table comprises populating a first column with an identifier of the earlier conditional statement and possible outcomes of the earlier conditional statement, populating a second column with an identifier of the later conditional statement and possible outcomes of the later conditional statement and populating a third column with an identifier of a combination of the earlier and later conditional statements and possible outcomes of the combination of the earlier and later conditional statements and the assessing of the truth table for each conditional statement comprises: determining, given the order of the instructions of the code, whether a later conditional statement overlaps with an earlier conditional statement as evidenced by corresponding entries in the first, second and third columns; and flagging at least one of the later conditional statement and the earlier conditional statement as an issue if the later conditional statement and the earlier conditional statement are both true such that the later conditional statement is one of the unreachable code regions. 7. The method according to claim 6 , further comprising identifying additional issues in the code with similar overlapping conditional statements. 8. A method of analyzing redundancies in code with multiple programmers responsible for generating the code, the method comprising: receiving sections of the code from a first portion of each of the multiple programmers in parallel and from a second portion of each of the multiple programmers in series; and analyzing the code by: parsing the code to generate tokens; representing the tokens in a concrete syntax tree (CST); replacing the tokens with abstract terms in the CST to create an abstract syntax tree (AST); traversing the AST in an order of instructions of the code to identify conditional statements in the AST; populating a truth table for each conditional statement that has been identified with all possible outcomes of the conditional statement; assessing, in a prediction unit of a processor, the truth table for each conditional statement to identify issues by determining, given the order of the instructions of the code, whether a later conditional statement overlaps with an earlier conditional statement, and flagging at least one of the later conditional statement and the earlier conditional statement as an issue if the later conditional statement and the earlier conditional statement are both true such that the later conditional statement is an unreachable code region defined as a region of the code that will never run based on a logical construction of the earlier and later conditional statements; and issuing signals comprising proposed changes to the code to address and correct the issue separately to the first portion of each of the multiple programmers and the second portion of each of the multiple programmers. 9. The method according to claim 8 , wherein each token comprises a language-specific token and each abstract term comprises a generic value. 10. The method according to claim 8 , wherein the replacing of the tokens with the abstract terms comprises traversing the CST in an order of instructions of the code. 11. The method according to claim 8 , wherein each conditional statement comprises one or more of an if-else statement, a select statement, a switch statement and a ternary operator. 12. The method according to claim 8 , further comprising identifying additional issues in the code with similar overlapping conditional statements. 13. A computer program product for analyzing redundancies in code with multiple programmers responsible for generating the code, the computer program product comprising: a processor, which is receptive of sections of the code from a first portion of each of the multiple programmers in parallel and from a second portion of each of the programmers in series; and a memory, the memory having executable instructions stored thereon, which, when executed, cause the processor to execute a method of analyzing the code comprising: generating an abstract syntax tree (AST) to represent the code; identifying conditional statements in the AST; populating a truth table for each conditional statement that has been identified with all possible outcomes of the conditional statement; and assessing, by the processor in a prediction unit of the processor, the truth table for each conditional statement to identify issues in the code, wherein: the issues in the code that are identified in the truth table for each conditional statement by the prediction unit of the processor comprise instances in which unreachable code regions are present in the code, the unreachable code regions are defined as those regions of the code that will never run based on a logical construction of earlier and later conditional statements, and the method of analyzing the code, by the processor, further comprises issuing signals comprising proposed changes to the code to address and correct the issues separately to the first portion of each of the multiple programmers and the second portion of each of the multiple programmers to highlight the issue. 14. The computer program product according to claim 13 , wherein the method further comprises receiving the code as an input by the processor and the processor comprises: a lexicography unit configured to parse the code to generate tokens and to validate the code; a parsing unit configured to represent the tokens in a concrete

Assignees

Inventors

Classifications

  • G06F8/75Primary

    Structural analysis for program understanding · CPC title

  • Program code verification, e.g. Java bytecode verification, proof-carrying code (high-level semantic checks G06F8/43; prevention of errors by analysis, debugging or testing of software G06F11/36) · CPC title

  • Syntactic analysis · CPC title

Patent family

Related publications grouped by family.

External sources

Frequently asked questions

Answers are generated from the same data shown on this page.

What does patent US11656869B2 cover?
A method of analyzing code is provided. The method includes generating an abstract representation of the code, identifying conditional statements in the abstract representation, populating a truth table for each conditional statement that has been identified with all possible outcomes of the conditional statement and assessing the truth table for each conditional statement to identify issues.
Who is the assignee on this patent?
IBM
What technology area does this patent fall under?
Primary CPC classification G06F8/75. Mapped technology areas include Physics.
When was this patent published?
Publication date Tue May 23 2023 00:00:00 GMT+0000 (Coordinated Universal Time) (B2). Legal status and post-grant events are not shown on this page.
What related patents are in patentsdb?
We list 5 related publications on this page (citations in our corpus or others sharing the same primary CPC).