Code verification by tree reconstruction
First Claim
1. A method for verifying a code sequence to be executed on a computer, the method comprising:
- constructing an abstract syntax tree from the code sequence; and
determining whether the abstract syntax tree satisfies a predefined set of conditions, wherein the predefined set of conditions is indicative of the code sequence being executable on the computer without generating a predefined class of execution errors.
2 Assignments
0 Petitions
Accused Products
Abstract
A system and method are provided that allow for improved code sequence verification through the use of an abstract syntax tree. This is accomplished by first constructing an abstract syntax tree from the code sequence and then determining whether the abstract syntax tree satisfies a predefined set of conditions indicative of the code sequence being executable on the computer without generating a predefined class of execution errors. The abstract syntax tree is constructed by reassembling the code sequence into a plurality of instructions, combining the instructions into a plurality of blocks, examining the blocks to determine entry points of a plurality of loops, and tagging locations in the series of instructions where control is transferred at the end of each loop. The instructions, blocks, loops and tagged locations are then examined to generate a plurality of control structures (the coarse structure). Finally, the instructions, blocks, loops, tagged locations and control structures are examined to generate a plurality of form expressions (the fine structures).
125 Citations
23 Claims
-
1. A method for verifying a code sequence to be executed on a computer, the method comprising:
-
constructing an abstract syntax tree from the code sequence; and
determining whether the abstract syntax tree satisfies a predefined set of conditions, wherein the predefined set of conditions is indicative of the code sequence being executable on the computer without generating a predefined class of execution errors. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
reassembling the code sequence into a plurality of instructions;
combining the instructions into a plurality of blocks;
examining the blocks to determine entry points of a plurality of loops; and
tagging locations in the series of instructions where control is transferred at the end of each loop.
-
-
3. The method of claim 2, wherein constructing the abstract syntax tree further comprises:
-
examining the instructions, the blocks, the loops and the tagged locations to generate a plurality of control structures; and
examining the instructions, the blocks, the loops, the tagged locations and the control structures to generate a plurality of form expressions.
-
-
4. The method of claim 1, further comprising analyzing the abstract syntax tree to optimize the code sequence.
-
5. The method of claim 1, further comprising using the abstract syntax tree to generate recompiled source code from the code sequence.
-
6. The method of claim 1, further comprising adding tracing or debugging code segments to the code sequence at run time based on code abstract syntax tree.
-
7. The method of claim 1, further comprising adding resource monitoring code segments to the code sequence at run time based on the abstract syntax tree.
-
8. The method of claim 1, further comprising displaying a structure of the abstract syntax tree in graphical form.
-
9. The method of claim 1, further comprising generating a flow diagram from the abstract syntax tree representing a control flow of the code sequence.
-
10. The method of claim 1, further comprising analyzing the abstract syntax tree to ensure compliance of the code sequence with a set of predefined coding specifications.
-
11. A computer system connected to the Internet and executing a computer program for verifying computer code sequences downloaded from the Internet, the computer program comprising computer instructions for:
-
constructing an abstract syntax tree from the code sequence; and
determining whether the abstract syntax tree satisfies a predefined set of conditions, wherein the predefined set of conditions is indicative of the code sequence being executable on the computer without generating a predefined class of execution errors. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
reassembling the code sequence into a plurality of instructions;
combining the instructions into a plurality of blocks;
examining the blocks to determine entry points of a plurality of loops; and
tagging locations in the series of instructions where control is transferred at the end of each loop.
-
-
13. The computer system of claim 12, wherein the computer instructions for constructing the abstract syntax tree further comprise computer instructions for:
-
examining the instructions, the blocks, the loops and the tagged locations to generate a plurality of control structures; and
examining the instructions, the blocks, the loops, the tagged locations and the control structures to generate a plurality of form expressions.
-
-
14. The computer system of claim 11, wherein the computer program further comprises computer instructions for analyzing the abstract syntax tree to optimize the code sequence.
-
15. The computer system of claim 11, wherein the computer program further comprises computer instructions for using the abstract syntax tree to generate recompiled source code from the code sequence.
-
16. The computer system of claim 11, wherein the computer program further comprises computer instructions for adding tracing or debugging code segments to the code sequence at run time based on the abstract syntax tree.
-
17. The computer system of claim 11, wherein the computer program further comprises computer instructions for adding resource monitoring code segments to the code sequence at run time based on the abstract syntax tree.
-
18. The computer system of claim 11, wherein the computer program further comprises computer instructions for displaying a structure of the abstract syntax tree in graphical form.
-
19. The computer system of claim 11, wherein the computer program further comprises computer instructions for generating a flow diagram from the abstract syntax tree representing a control flow of the code sequence.
-
20. The computer system of claim 11, wherein the computer program further comprises computer instructions for analyzing the abstract syntax tree to ensure compliance of the code sequence with a set of predefined coding specifications.
-
21. A computer-readable storage medium comprising a computer program for verifying computer code sequences downloaded from the Internet, wherein the computer program comprises computer instructions for:
-
constructing an abstract syntax tree from the code sequence; and
determining whether the abstract syntax tree satisfies a predefined set of conditions, wherein the predefined set of conditions is indicative of the code sequence being executable on the computer without generating a predefined class of execution errors. - View Dependent Claims (22, 23)
reassembling the code sequence into a plurality of instructions;
combining the instructions into a plurality of blocks;
examining the blocks to determine entry points of a plurality of loops; and
tagging locations in the series of instructions where control is transferred at the end of each loop.
-
-
23. The computer-readable storage medium of claim 22, wherein the computer instructions for constructing the abstract syntax tree further comprise computer instructions for:
-
examining the instructions, the blocks, the loops and the tagged locations to generate a plurality of control structures; and
examining the instructions, the blocks, the loops, the tagged locations and the control structures to generate a plurality of form expressions.
-
Specification