IP Library Granted Patent US 8,312,437
Granted Patent B2
US 8,312,437 · App. 12/345,691 · Granted Nov 13, 2012

Structured search in source code

Assignee: Microsoft Corporation
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 8,312,437
App. No.
12/345,691
Granted
Nov 13, 2012
Kind
B2
Abstract

Architecture allows a programmer to answer questions about the source code the programmer is authoring, questions that cannot be answered by other means. A searching mechanism is provided over a much more structured presentation of the source code. The architecture utilizes components that provide an intimate knowledge about the structure of the text, namely, the source code of some particular programming language. The search mechanism employs an abstract syntax tree representation of the code over which the search is conducted. The program source code (as edited by the programmer) is transformed into the abstract syntax tree to embody the structure of the program. If the syntax tree is provided in XML, for example, an XML search mechanism such as Xpath can be utilized to perform the actual searching. This tree is then queried, allowing richer searching criteria to be expressed (by virtue of the structured format of the tree).

Claims (34)

1. A computer-implemented search system, the search system comprising:

a processor; and

a memory in communication with the processor, the memory comprising computer-executable instructions that, when executed by the processor, cause the processor to

represent, utilizing a conversion component, a grammar of a program code as an abstract syntax tree; and

search, utilizing a search component, the abstract syntax tree based on a code-related query to obtain code results, the code-related query comprising an expression in a form of a grammatical unit, the processing of which by the search component initiates the search of the abstract syntax tree for program code statements contained within the program code.

2. The system of claim 1 , wherein the abstract syntax tree is represented in extensible markup language (XML).

3. The system of claim 1 , wherein the search component processes the query over the abstract syntax tree according to an extensible markup language (XML) query language.

4. The system of claim 1 , wherein the abstract syntax tree is stored in a cache and the search component performs the search on the abstract syntax tree in the cache.

5. The system of claim 1 , wherein the expression is a natural language expression.

6. A computer-implemented search system, the search system comprising:

a processor; and

a memory in communication with the processor, the memory comprising computer-executable instructions that, when executed by the processor, cause the processor to

represent, utilizing a conversion component, a syntax of a program code as an abstract syntax tree; and

search, utilizing a search component, the abstract syntax tree based on a code-based query to obtain code results, the code-based query comprising a natural language expression in a form of a grammatical unit, the processing of which by the search component initiates the search of the abstract syntax tree for program code statements contained within the program code as represented.

7. The system of claim 6 , wherein the abstract syntax tree is represented in extensible markup language (XML), and the search component processes the query over the abstract syntax tree according to an XML query language.

8. The system of claim 6 , wherein the abstract syntax tree is stored in a cache and the search component performs the search on the abstract syntax tree in the cache.

9. A computer-implemented method of searching code, the method comprising:

representing, utilizing a computer, a grammar of a program code as an abstract syntax tree;

searching, utilizing the computer, the abstract syntax tree based on a code-related query to obtain code results;

returning, utilizing the computer, the code results, the code results being associated with a portion of the abstract syntax tree;

mapping, utilizing the computer, the portion of the abstract syntax tree to a corresponding portion of the program code;

presenting, on a display in communication with the computer, a first view comprising the portion of the abstract syntax tree that includes the portion of the program code in which the code results are found;

presenting, on the display, a second view comprising the portion of the program code; and

facilitating toggle between the first view and the second view.

10. The method of claim 9 , further comprising representing the abstract syntax tree in extensible markup language (XML).

11. The method of claim 10 , further comprising searching the extensible markup language (XML) abstract syntax tree using an Xpath language.

12. The method of claim 9 , further comprising composing the query as an expression structured as a grammatical unit.

13. The method of claim 9 , wherein the query is a natural language expression.

14. The method of claim 9 , further comprising:

receiving, at the computer, input that navigates to a different portion of the abstract syntax tree; and

in response to receiving the input, presenting, on the display, a corresponding different portion of the program code in the second view.

15. The method claim 9 , further comprising:

receiving, at the computer, input that navigates to a different portion of the program code; and

in response to receiving the input, presenting, on the display, a corresponding different portion of the abstract syntax tree in the first view.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 9, 2014
From: MICROSOFT CORPORATION
To: MICROSOFT TECHNOLOGY LICENSING, LLC
Reel/Frame 034564/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 18, 2009
From: VILLADSEN, PETER
To: MICROSOFT CORPORATION
Reel/Frame 023108/0591 →
Continuity (1)
Related Publication 20100169871A1 · Jul 1, 2010