Patent Description:
Software programming is a complex endeavor that requires expert skill and, often, collaboration with other programmers. For example, an operating system (OS) may comprise thousands of lines of code that are written by different developers. Source code may be written any number of ways with different defined variables, routines, and other components, making it complex for even one developer, let alone many. Developers need robust tools to quickly search and find different parts of the program. <CIT> relates to an architecture that allows a programmer to answer questions about the source code the programmer is authoring. 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). <CIT> relates to a system and method for providing assistance to programmers during programming to reduce the number of routine tasks that must be performed. The system may provide for searching a corpus of source code based on keyword or natural language search input. Search results including code entities and snippets of code that are described by the search input are then provided as search results. Optionally, a neural network encoder is used to generate tensor embeddings of source code and related text in a joint tensor space. Relatedness between embeddings in this joint tensor space for text and associated source code is used to facilitate code search.

It is the object of the present invention to provide an improved method and system for querying code.

Examples and embodiments disclosed herein are directed to a code notebook and backend cloud service configured to intelligently analyze program source code that a developer wants analyzed, targeted, or indexed. The source code being analyzed, targeted, or indexed is uploaded to a cloud-computing environment, where a code database of the source code is built and used for querying the source code. The code database is augmented with the results of various machine-learning models applied to the target code. These machine-learning models seek to capture and encode the underlying semantics and structures of the target source code. Also, embodiments are able to run a flow analysis for a particular type of operational analyses and store the result in the code database for querying. The code notebook resides as an application on a client computing device and includes APIs that allow the user to draft and submit code queries using fuzzy logic about variables, types, data, code structure, and program flows to be searched. These code queries are submitted against the code database in the cloud-computing environment, and query results are returned to the client computing device of the developer. The code notebook also includes a representation of the source code being queried, and the query results are visually identified in this representation.

References made throughout this disclosure relating to specific examples and implementations are provided solely for illustrative purposes but, unless indicated to the contrary, are not meant to limit all examples.

Similarly, traditional tools for analyzing source code generally require users to specify exact and precise constraints on program flows or program structure. Generally, there are two ways that source is analyzed: through code analysis tools, and through human inspection tools. Conventional code analysis tools today provide a programmatic way of finding certain poor coding patterns in source code and then emit warnings about them. Conventional human inspection tools allow a user to interact with the source code are limited in their searching functions to only include exact textual matches to user search queries, or possibly regular-expression matching. For example, a user provides text to be searched, and traditional search features look for that exact text in the source code. A user may search for different instances of a particular variable by typing the variables name and hitting a search feature. Such searching requires the user to correctly type in the variable name, and the results only identify instances of the exact search term the user typed. Today's human inspection tools do not provide semantic nor structure searching. Traditional analysis tools are either limited to searching for poor coding patterns or often suited only to expert users (developers) who know exactly what text to search.

The embodiments and examples disclose a code notebook that enables a user to conduct semantic, structural, and/or programming-flow queries on program source code. The code notebook provides a UI on a client computing device with a query window for a user to submit different code queries, a representation area showing the program source code in which query results are identified, and a bookmark area that allows the user to quickly navigate to different portions of the source code where the query results are identified. These three UI portions allow the user to quickly submit queries and view the query results in the program source code, without having to know the exact terminology used.

In some embodiments, the user uploads program source code to a cloud-computing environment (or "cloud") where the source code is analyzed, augmented, and made queryable (or searchable) by the disclosed code notebook. A fluent query API allows developers to compose code queries in the client-side UI of the code notebook. Machine-learning extensions allow for fuzzy constraints to be submitted by the user and semantically expanded to locate similar query terminology in the source code. For instance, a user may query for instances of the variable "settings" in source code using the machine-learning extensions, and embodiments are able to locate semantically similar variables "options," "configurations," "config," or the like-without the user having to specific those variables. Moreover, the disclosed code notebook also allows the user to query the source code for particular code structures (e.g., for loops, if/then statements, etc.) and/or programming-flow analyses (e.g., variable A that is used to generate a different variable B). Allowing the user to query their source code using a combination of fuzzy semantics, code structure, and programing-flow provides robust analytical tools to the user directly in the code notebook.

In particular, the semantic searches allow the user to query terms in the source code, and the disclosed embodiments look not only for those search terms but also for semantically similar terms that are also in the source code. "Semantic searches," as disclosed herein, refer to searches for specific query terms provides by a user (e.g., a variable name) and also synonymous query terms that are determined to be semantically equivalent to the query terms through machine learning of larger data sets. These searches are deemed to be "fuzzy" because they include a first set of text ("find String ABC") but are expanded to search for semantically equivalent text ("String XYZ"). In some embodiments, this semantic equivalency is performed using a machine learning service that learns latent spaces of vectors (embeddings). In this latent space, semantically equivalent (synonymous) words are close together and dissimilar words are far apart. This latent space is generated by learning from large data sets, such as the World Wide Web. Thus, in some embodiment, the semantic equivalency (or similarity) is, more generally, encoded by distances in a learned latent space. This learned space is not, in general, includes encoding synonymous words with nearby vectors, as well as other relationships between text. For example, if a user searches for all namespaces named "settings," the disclosed embodiments will also show the user instances of namespaces "options," "configurations," or other types of similar namespaces-and without the user having to specify anything than the original search terms. In other words, the search that the user initiated is automatically expanded, through distances in the latent space of vectors (embeddings, to include terms that may have the same meaning as the user's search terms-as determined through machine learning.

The structural queries allow the user to query and locate various structural constraints in source code. "Structural queries," as disclosed herein, refer to the structure of the source code, otherwise referred to as the "structural code elements. " Examples of structural code elements include, without limitation, specific declarations, code operations (e.g., for loops, if/then statements, while loops, or the like); operational counts (e.g., number of times code is declared, databases are accessed, etc.); and the like. In some embodiments, the structural queries are executed by locating the strict constraints entered by the user. For example, if the user queries the number of times a variable (semantic query) is run in a for loop (structural query), the source code is analyzed for the number of times that variable and its semantic equivalents are found in for loops-the former being a fuzzy search for semantically equivalent text (as determined, in some embodiments, through latent spaces and vectors) while the latter is a strict search for code structure.

Some of the disclosed embodiments use a plugin to a compiler frontend to extract information during compilation of the source code. This extracted compiler information is outputted to a relational database using a Merkel-Tree-style hashes to uniquely identify different elements across projects and compiler translation units (or stages). Machine-learning embeddings are added to the created database of the source code to enable efficient querying for relevant data using semantic and structural flow searches inside the database.

The program flow analyses allow the user to query and locate different program flows. "Program flows," "program flow analyses," and "flow queries," as disclosed herein, refer to the operational workflows for assigning variable A to another variable B, using variable B as an argument to a function call "foo(B)," and then identifying the relationship between function call foo and A (as A flowed into B and then into foo(. For example, in the following code "Anonymous" is originally assigned to string A, but different operations reassign A to various values that are returned:
<IMG>
<IMG>
The relationship between Anonymous and A is identified as an workflow operation. Some embodiments use externally defined analyses (not limited to flow analyses) encoded in datalogs. These external datalog analyses are applied against the cloud database created from program source code to augment the source code database with information produced by the datalog analyses (such as program flow information).

Embodiments allow the user to upload source code to a cloud-computing environment, where it is ingested and used to create a code database that may be queried. Using the disclosed tools, the user may submit fuzzy queries consisting of semantic searches, either alone, or in combination with structural queries. The text of the semantic searches may be expanded to capture semantic equivalences, and the structural searches may be used to identify particular code operations.

Additionally, the source code is analyzed to understand-or machine learn-its program flows. These program flow may be organized in one or more tree structures that designate how variables and operations are interrelated in the source code. Some embodiments use these uncovered flow operations to expand the semantic searches beyond just the query text and its semantic equivalence to also include ending other non-semantically equivalent variables and operations that use, depend on, or are otherwise programmatically related to the query text and its semantic equivalence. Following the aforementioned example, if a user searches for "settings" in "for loops," embodiments query for such text and structure but may also find out that the semantic equivalent variable "options" is used in an operation that produces a resultant variable called "WindowSize," which is not semantically equivalent to settings but nevertheless is impacted by the settings variable. Some embodiments take this into account and include the WindowSize variable in the query results that are shown to the user-either with or without the user specifically requesting such expansion. Thus, the program flow analyses described herein provide a way to expand the code queries beyond mere semantics and structure to cover the program flows of the source code.

Additionally, this disclosure refers to "program source code" and "source code" interchangeably. Both phrases mean the same thing in this disclosure, namely program instructions that have been written in a programming language (e.g., C, C++, Java, etc.).

Having generally provided an overview of some of the disclosed examples, attention is drawn to the accompanying drawings to further illustrate some additional details. The illustrated configurations and operational sequences are provided to aid the reader in understanding some aspects of the disclosed examples. The accompanying figures are not meant to limit all examples, and thus some examples may include different components, devices, or sequences of operations while not departing from the scope of the disclosed examples discussed herein. In other words, some examples may be embodied or may function in different ways than those shown.

<FIG> illustrates a block diagram of a client computing device <NUM> configured to provide a code notebook for querying source code, according to the disclosed embodiments. Client computing device <NUM> includes one or more processors <NUM>, input/output (I/O) ports <NUM>, a communications interface <NUM>, computer-storage memory (memory) <NUM>, I/O components <NUM>, and a communications path <NUM>. The client computing device <NUM> is able to communicate over a network <NUM> with other devices, such as the disclosed cloud-computing resources.

The client computing device <NUM> may be any of several types of computing device, such as, for example but without limitation, a laptop, smartphone, tablet, virtual reality (VR) or augmented reality (AR) headset, or the like. While the client computing device <NUM> is depicted as a single device, multiple client computing devices <NUM> may work together and share the depicted device resources. For instance, various processors <NUM> and memory <NUM> may be housed and distributed across multiple client computing devices <NUM>. The client computing device <NUM> is but one example of a suitable computing environment and is not intended to suggest any limitation as to the scope of use or functionality of the invention.

The processor <NUM> includes any number of microprocessors, microcontrollers, graphics programming units (GPUs), central processing units (CPUs), quantum processing units (QPUs), analog circuitry, or the like for that are programmed to execute computer-executable instructions for implementing aspects of this disclosure. In some examples, the processor <NUM> is programmed to execute instructions such as those illustrated in the other drawings discussed herein. In some implementations, the processor <NUM> is programmed with instructions to function for the specialized purpose of providing a code notebook that allows a user to enter a query about program source code to be executed in the cloud and then see resultant query results.

The I/O ports <NUM> connect various hardware I/O components <NUM> to the client computing device <NUM>. Example I/O components <NUM> include, for example but without limitation, one or more microphones 110a, cameras 110b, and speakers 110c that operate to capture and present audio/visual content. The client computing device <NUM> may additionally or alternatively be equipped with other hardware I/O components <NUM>, such as, for example but without limitation, displays, touch screens, AR and VR headsets, peripheral devices, joysticks, scanner, printers, etc. Such components are well known to those in the art and need not be discussed at length herein.

The communications interface <NUM> allows software and data to be transferred between the client computer device <NUM> and external devices over the network <NUM>. The communications interface <NUM> may include a modem, a network interface (such as an Ethernet card), a communications port, a Personal Computer Memory Card International Association (PCMCIA) slot and card, a wireless adapter, etc. Software and data transferred via the communications interface <NUM> are in the form of signals that may be electronic, electromagnetic, optical, or other signals capable of being received by communications interface <NUM>. Such signals are provided to the communications interface <NUM> via the communications path (e.g., channel) <NUM>. The communications path <NUM> carries the signals and may be implemented using a wired, wireless, fiber optic, telephone, cellular, radio frequency (RF), or other communications channel.

The network <NUM> may include any computer network or combination thereof. Examples of computer networks configurable to operate as network <NUM> include, without limitation, a wireless network; landline; cable line; digital subscriber line (DSL): fiber-optic line; cellular network (e.g., <NUM>, <NUM>, <NUM>, etc.); local area network (LAN); wide area network (WAN):, metropolitan area network (MAN); or the like. The network <NUM> is not limited, however, to connections coupling separate computer units. Rather, the network <NUM> may also comprise subsystems that transfer data between servers or computing devices. For example, the network <NUM> may also include a point-to-point connection, the Internet, an Ethernet, an electrical bus, a neural network, or other internal system. Such networking architectures are well known and need not be discussed at depth herein.

The computer-storage memory <NUM> includes any quantity of memory devices associated with or accessible by the client computing device <NUM>. The computer-storage memory <NUM> may take the form of the computer-storage media referenced below and operatively provides storage of computer-readable code, data structures, program modules, and other code for the client computing device <NUM> to store and access instructions configured to carry out the various operations disclosed herein. The computer-storage memory <NUM> may include memory devices in the form of volatile and/or nonvolatile memory, removable or non-removable memory, data disks in virtual environments, or a combination thereof. Examples of client computing device <NUM> include, without limitation, random access memory (RAM); read only memory (ROM); electronically erasable programmable read only memory (EEPROM); flash memory or other memory technologies; CDROM, digital versatile disks (DVDs) or other optical or holographic media; magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices; memory wired into an analog computing device; or any other computer memory.

The computer-storage memory <NUM> may be internal to the client computing device <NUM> (as shown in <FIG>), external to the client computing device <NUM> (not shown), or both (not shown). Additionally or alternatively, the computer-storage memory <NUM> may be distributed across multiple client computing devices <NUM> and/or servers, e.g., in a virtualized environment providing distributed processing. For the purposes of this disclosure, "computer storage media," "computer-storage memory," "memory," and "memory devices" are synonymous terms for the computer-storage media <NUM>, and none of these terms include carrier waves or propagating signaling.

In some examples, the computer-storage memory <NUM> stores executable computer instructions for an operating system (OS) <NUM> and various software applications <NUM>. The OS <NUM> may be any OS designed to control the functionality of the client computing device <NUM>, including, for example but without limitation: WINDOWS® developed by the MICROSOFT CORPORATION® of Redmond, Washington, MAC OS® developed by APPLE, INC. ® of Cupertino, California, ANDROID™ developed by GOOGLE, INC. ® of Mountain View, California, open-source LINUX®, and the like.

Among other programs, the applications <NUM> include a code notebook <NUM> that allows a user to analyze source code by submitting various semantic, structural, and/or flow analysis code queries. The code notebook <NUM> is an executable software application <NUM> for creating and analyzing program source code. Among other things, the code notebook <NUM> provides interfaces for code development, data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, cloud ingestion, and other features for creating and analyzing source code. Though, embodiments are not limited to any particular type of code notebook <NUM>, alternative embodiments use other types of code notebooks <NUM>, such as, for example but without limitation, PyCharm, Apache Zeppelin, Apache Spark Notebook, RSTUDIO®), and the like.

In some embodiments, the code notebook <NUM> generates a local build <NUM> of program source code <NUM> that a user is developing or otherwise has selected to be analyzed. This local build <NUM> of the source code <NUM> may be transmitted to a cloud environment discussed below for ingestion by a cloud-based service that provides the ability to perform the queries disclosed herein. Alternatively, the source code <NUM> may be analyzed and ingested, and a database (e.g., SQL) thereof may be built directly on the client computing device <NUM>. For the sake of clarity, embodiments are discussed in a client-server architecture, where the client computing device <NUM> transmits either the local build <NUM> of the source code <NUM>, or the source code itself, to the cloud for ingestion, database building, and the answering of code queries.

The code notebook <NUM> includes an integrated development environment (IDE) plugin <NUM> that is capable of reading the source code <NUM> and interactively scraping data to power visualizations thereof within the code notebook UI <NUM>, specifically within the code representation <NUM> discussed below. In some embodiments, the IDE plugin <NUM> is a VISUAL STUDIO® code plugin that provides the ability to display the disclosed query results directly in an editor view (e.g., the code representation) of the source code. The source code <NUM> is shown visually and interactively in a code representation <NUM> area of the code notebook UI <NUM>.

The code notebook <NUM> includes one or more query application programming interfaces (APIs) <NUM> that allow a user to run queries on the source code <NUM>. The query APIs <NUM> include various query functions for creating and submitting code queries. In operation, the APIs <NUM> translate the query functions submitted in a query into database queries. For example, a user may submit a query through a VISUAL STUDIO® IDE using the defined query functions of the APIs <NUM>, and the APIs <NUM> may then translate those query functions (or the query in its entirety) into a database query language (e.g., SQL) for querying a database created from the source code <NUM>. Thus, in some embodiments, the APIs <NUM> provide both client-side query functions for creating code queries and backend database functions for actually querying a database generated from the source code <NUM>.

The code notebook UI <NUM> also includes several different UI portions in the form of a bookmark area <NUM>, a query window <NUM>, and a code representation <NUM>. Other embodiments replace the bookmark area <NUM> by visualizations rendered in the query window <NUM>. As previously mentioned, the code representation <NUM> shows the actual source code <NUM> being analyzed. The query window <NUM> is a UI window that allows the user to submit a code query to run on the source code <NUM>, for example, using the various query functions that are available through the query APIs <NUM>. Again, these query functions allow the user to create and submit a code query comprising any combination of semantic queries <NUM>, structural queries <NUM>, and flow analysis queries <NUM>. Once a code query is submitted, the APIs <NUM> translate the code query into database queries that may be run on a database of the source code <NUM>. The query APIs <NUM> provide a set of programmatic functions for the user to specify the code query in the query window <NUM>.

As previously discussed, code queries may specify semantic and structural searches. Additionally, the source code <NUM> may be analyzed to understand-or machine learn-its program flow operations. These flow operations may be organized in one or more tree structures that designate how variables and operations are interrelated in the source code <NUM>. Some embodiments use these uncovered flow operations to expand the semantic searches beyond just the query text and its semantic equivalence to also include ending other non-semantically equivalent variables and operations that use, depend on, or are otherwise programmatically related to the query text and its semantic equivalence.

Once the query is run on the database of the source code <NUM>, results of the code query are provided to the client computing device <NUM> and shown directly in the code representation <NUM>. The code representation <NUM> is a UI window within the code notebook UI <NUM> that shows the actual source code <NUM>, and that indicates (e.g., through highlighting, bolding, italicizing, changing color, or otherwise visually designating) query results directly in the source code <NUM>. For example, if a user submits a code query searching for all the instances of the variable "settings" that are used in for loops within the source code, the disclosed embodiments may expand that search term out to other semantically equivalent, or synonymous, terms (e.g., configurations, config, options, or the like) that are found in for loops. In another example, the user may submit a code query searching for all sections of the source code that define B-trees or index structures, which may be named many different things, and the disclosed embodiments create a fuzzy search searches for such B-trees or index structures in the code regardless of name. These results to the code queries are indicated in the code representation <NUM>, e.g., through highlighting, bolding, italicizing, changing color or font size, jumping directly to bookmarked portions, or other identifications.

In some embodiments, the code representation <NUM> also includes an editor that allows the user to directly edit the source code <NUM>. In such embodiments, the code notebook UI <NUM> provides the user with a single application for querying the source code <NUM> (using fuzzy logic), viewing results of such code queries, and directly editing the source code <NUM>. The ability to quickly submit and view powerful code queries frequently causes the user to want to change the source code <NUM> in some manner. They are able to do just that using the editor within the code representation <NUM>. Some embodiments also include an API capable of performing a user's desired edits on all query results, including making on specific code structural contexts. The latter being referred to as "structured editing. " For example, the user may first submit a query, and then may want to edit or otherwise augment the source code using the results from the query as the targets of a modification operation.

an API capable of performing the user's desired edits not on individual instances but on ALL query results, is something we envision and are working on. Changing these edits in specific structural contexts is also part of this idea. We call this "structured editing" and see it as another reasonable piece of the "code book" idea: first, you query. Then, you may want to edit or otherwise augment using the matches from your query as the "targets" of said operation.

Along those lines, the bookmark area <NUM> provides a list of bookmarked portions of the source code where results to code queries are found. For instance, a user may submit a code query, embodiments highlight (or otherwise indicate) the results of the code query in the source code, and the bookmark area provides actionable links that allow the user to jump to the various portions of the source code in the code representation <NUM> where the results are located. In other embodiments, the bookmarks may also be directly rendered in a visually distinct way in the query window <NUM>. Thus, the code notebook UI <NUM> provides an integrated tool that allows the user to submit code queries for source code, see the results of those queries in the code representation <NUM>, and jump to different query results using the bookmark area <NUM>.

Several examples of the bookmark area <NUM>, the query window <NUM>, and the code representation <NUM> are shown in the accompanying UI drawings of <FIG> and discussed in the corresponding text below.

Numerous different code searches may be carried out and are far too numerous to describe herein. That said, it should be noted that the disclosed embodiments enable a user to submit semantic queries, structural queries, flow analysis queries, or a combination thereof. Using the disclosed code notebook <NUM>, the user may submit code queries by specifying fuzzy text that may be extrapolated out to identify where such text is located as well as where semantically equivalent, or synonymous text, is located in the source code <NUM>. These fuzzy textual searches may be queries alone or in combination with structural constraints using the disclosed code notebook <NUM>, and may also be expanded based on the discovered program flows in the source code <NUM>. For example, a code query may request specific variables, and their equivalents, that access a SQL query but that are inside of a loop body condition, which is an inefficient way to query a database due to the iterative network demands. Without knowing the structure of the source code <NUM> around such a SQL query, traditional code-analysis software make such a query impossible to perform. Yet, the disclosed embodiments allow such a query to be submitted using and a combination of structural and flow analysis techniques to identify the instances in the source code <NUM> where such SQL queries are found within loop conditions, irrespective of code semantics- or based filtered by specific variable names.

<FIG> illustrates a block diagram of a networking environment for operating a cloud service in a cloud environment <NUM> that answers code queries for program source code, according to some of the disclosed embodiments. As shown, various client computing devices <NUM> communicate over a network <NUM> with a collection of servers <NUM> that make up the cloud environment <NUM>. The servers <NUM> may include physical servers 201a, virtual machines (VMs) 201b, or a combination thereof, and may include various dedicated, relational, virtual, private, public, hybrid, or other cloud-based resource. An example server topology for the cloud environment <NUM> is illustrated in <FIG> and discussed in more depth below. One skilled in the art will understand and appreciate that different server topologies may be used to construct the cloud environment <NUM>.

In one instance, tangible hardware elements, or machines, are integral, or operably coupled, to the servers 201a,b to enable each device or VM to perform a variety of processes and operations. Specifically, the servers <NUM> include or have access to various processors <NUM>, I/O ports <NUM>, communications interfaces <NUM>, computer-storage memory <NUM>, I/O components <NUM>, and communications paths <NUM>. Though not shown, the processors <NUM> execute a server OS that underlies the execution of software, applications, and computer programs thereon. In particular, the processors <NUM> employed in the cloud-computing environment <NUM> may include real or virtual CPUs, GPUs, quantum processors, or the like. While shown as singular block units for clarity, the processors <NUM>, I/O ports <NUM>, communications interfaces <NUM>, computer-storage memory <NUM>, I/O components <NUM>, and communications paths <NUM> may be located on and executed by different servers 201a and/or VMs 201b.

The memory <NUM> includes executable instructions for middleware <NUM>, an embedder <NUM>, and a query service <NUM>. Both the middleware <NUM>, the embedder <NUM>, and the query service <NUM> are executable code instructions that cause the processors <NUM> to be specifically programmed for building, analyzing, and ingesting a code database <NUM> of the source code <NUM>. The code database <NUM> is a database of the compiled and executed source code <NUM>.

The middleware <NUM> includes a compiler plugin <NUM> that is a portion of a compiler that parses the source code <NUM> and generates a remote build <NUM> of the source code <NUM>. This remote build <NUM> may then be used to create a code database <NUM> of the source code <NUM>. In some specific examples, the code database <NUM> is stored in a relational database management system (RDBMS) and is created from the source code <NUM>-or, more accurately, from the remote build <NUM> of the source code <NUM>. Ingestion of the source code <NUM> into the cloud-computing environment <NUM> involves generating the code database <NUM> from the source code in the cloud-computing environment <NUM>.

Several sets of instructions cause the processors <NUM> to identify different key portions of the source code <NUM> in the code database <NUM>: a semantic analyzer <NUM>, a structure analyzer <NUM>, and a flow analyzer <NUM>. In some embodiments, the structure analyzer <NUM> is included the middleware <NUM>, and the semantic analyzer <NUM> and flow analyzer <NUM> are not. In operation, the semantic analyzer <NUM> augments the code database <NUM> by attaching semantic representations to various pieces of data (e.g., variable/subroutine names, string literals, comments, etc.). In some embodiments, such semantic representations denote the semantic equivalencies of synonymous words or phrases. In others, the semantic representations may be vectors (embeddings) made by semantics-focused machine-learning algorithms that analyze textual data across large data sets, such as the World Wide Web or other program source code, to create a latent space in which words or phrases may be embedded. For example, the term "settings" may be deemed to be equivalent with "configurations," "config," "options," or some other semantically similarly term through analyzing respective vectors of text from a collection of online documents or other source code mapped in latent space.

In the latter example, using latent space mappings, machine-learning algorithms convert text to vectors and then compare the proximity of those vectors to other numbers indicative of other text. If the vectors of a particular variable ("settings") are within a numerical threshold of the numbers of another text ("configurations"), the corresponding text of those two vectors are deemed to be semantically equivalent. This latent space is learned by a machine-learning algorithm and, in this space, elements that are "close" (within a threshold distance or degree of separation) are semantically similar.

The compiler plugin <NUM> parses and identifies the different code structures in the source code <NUM>. For example, if/then, while, for loops; network requests; and as other specific code operations are identified in the source code <NUM>. In some embodiments, these code structures are identified through strict matching rules, e.g., looking for the combination of "for" plus a subsequent operand. Alternatively or additionally, these code structures are learned through a structure-focused machine-learning algorithms that analyze data sets of other code and learn the code operations therefrom. In some embodiments, the compiler plugin <NUM>.

The flow analyzer <NUM> identifies specific program flows in the program source code <NUM> from instantiation (variable <NUM>) to subsequent variable (variable <NUM>) through execution of different programming operations. The following provides one example of a program flow that may be identified by the flow analyzer <NUM>, where Variable A is deemed to impact function print(C): <MAT> In another example, suppose a user queried to find instances of the integer literal <NUM>. In this hypothetical embodiment, results are expanded based on program flows (even without the user asking). To do so, the IDE plugin <NUM> highlighted kValueType = 0x01 and kValueTypeForSeek = kValueType because, based on program flows, it was determined that kValueTypeForSeek received a value of '<NUM>' (from kValueType).

To provide such program flow analyses, some embodiments use external datalog engines and external, separately defined, datalog analyses that are executable to capture program flow information and augment the code database <NUM> with that information. In other embodiments, program flows related information (e.g., call graphs, aliasing, points-to information, intervals analysis, etc.) are captured and. Still Other embodiments create tree structures of the various data and operations within the source code <NUM>, thereby providing a structure that may be queried against.

The semantic equivalences, code structures, and program flows that are identified are designated in the code database <NUM>. The middleware <NUM>, the embedder <NUM>, or some other service are configured to insert, append, or otherwise add embeddings to the code database <NUM> that species these semantic equivalences, code structures, and operational workflows. For instance, variable names that are semantically equivalent may be associated with each other. Code structures of the same type may be associated with each other. Tree structures of program flows may be stored in the code database <NUM>. Together, this rich data enables powerful code queries to be run on the code database <NUM> that include fuzzy semantic searches combined with strict structure queries and program flows, providing search capabilities that extend far beyond just searching for specific text in the source code <NUM>.

The query service <NUM> runs the code queries submitted by the user on the code database <NUM>, which, again, is populated with the previously discussed semantic, structure, and flow designations. In some embodiments, these code queries include a combination of the semantic searches and structural queries, and the program flows are added to expand the code queries further to capture data that is programmatically related. In other embodiments, the user requests the program flows be searched in the code queries, along with semantic or structural queries. For example, the user may submit the following code query, "find all integer literals that flow to calls to functions with names like Sleep," which may yield results such as "DelayMicroseconds(<NUM>). " This code query includes both a flow query, a structure query, and a semantic search. While the user may specify semantic and structural portions of a code query, some embodiments automatically analyze such searches in line with previously discovered (or machine learned) program flows of the source code <NUM>; yet, other embodiments, conduct such searching based on flow queries that are submitted by the user-in addition to the semantic and structural searches. The query service <NUM> is configured to search the code database <NUM> accordingly and identify query results that answer the code queries. These query results are then communicated to the client computing device <NUM> where the query results are shown in the code notebook UI <NUM>.

<FIG> illustrates a block diagram of the source code <NUM> being submitted to and built in the cloud-computing environment <NUM> to create the code database <NUM> upon which code queries may be submitted, according to some of the disclosed embodiments. Depicted configuration <NUM> is divided to show portions of the client computing device <NUM> interacting with the cloud-computing environment <NUM> across the network <NUM>. As previously discussed, the client computing device <NUM> includes the code notebook <NUM>. Again, the code notebook <NUM> comprises the IDE plugin <NUM>, the code notebook UI <NUM>, and (in some embodiments) the source code <NUM> that is to be uploaded to the cloud-computing environment <NUM>. In particular, the code notebook UI <NUM> includes the bookmark area <NUM>, the query window <NUM>, and the code representation <NUM> for a user <NUM> to interact with the source code <NUM>, submit code queries, and view query results. Looking at the cloud-computing environment <NUM>, the embedder <NUM>, the code database <NUM>, the middleware <NUM>, and the remote build <NUM> are stored and hosted on three or more VMs 201b. The code database <NUM>, the middleware <NUM>, and the remote build <NUM> may be hosted by servers 201a, a single VM 201b, or a combination of VMs 201b and servers 201a.

In operation, the local build <NUM> of the source code <NUM> is created on the client computing device <NUM>. This local build <NUM> may include just the source code <NUM> or a compiled version of the source code <NUM>. The local build <NUM> is uploaded to the cloud-computing environment <NUM>, where the remote build <NUM> is generated by the middleware <NUM>. The remote build <NUM> may be generated after compiling the source code <NUM>-either on the client computing device <NUM> or by the middleware <NUM> in the cloud-computing environment <NUM>. The middleware <NUM> creates the code database <NUM> from the remote build <NUM>, and the embedder <NUM> analyzes the code database <NUM> to identify the semantic equivalences of-or in-the source code <NUM>. Code structures are extracted by the compiler plugin <NUM>. Program flows are extracted by the, in some embodiments, datalog engine of the flow analyzer <NUM>. Various embeddings that specify the learned semantic equivalences, code structures, and program flows are stored in the code database <NUM>, or associated therewith.

Code queries from the user <NUM> that are submitted through the query window <NUM> are transmitted to the cloud-computing environment <NUM>. Though not shown for clarity, the query service <NUM> queries the code database <NUM> and obtains, or receives, results of the query run on the code database <NUM> (which, again, is the executed program source code <NUM>). These query results are transmitted back to the cloud computing device <NUM> where the results may be shown to the user <NUM> in the representation area <NUM> of the code notebook UI <NUM>, and the bookmark area <NUM> may be configured to show bookmarked areas of the source code where the query results are located.

In operation, a user may trigger the remote build <NUM> of the program source code <NUM> using a specified back-end cloud service provider. This will, locally, build a Docker image containing the source code <NUM> code (and encapsulating the desired build processing). In some embodiments, this local image is pushed to an appropriate Docker registry at which point the back-end cloud service provider pulls the newly pushed image to prepare for the remote build <NUM>.

In some embodiments, the back-end provider runs a container using the newly pulled image and, via the compiler plugin <NUM> embedded in the base image, extracts (with the help of the middleware <NUM> that listens to several instances of the compiler plugin <NUM> during concurrent builds) data from the compiler about the target program. In some embodiments, this data is stored in the code database <NUM>. The data captured may be, roughly, a "heap graph" of the compiler during compile time (early on, but after the compiler has built abstract syntax trees (ASTs) for the target.

In some embodiments, the embedder <NUM> runs on a graphics processing unit (GPU) VM to take target rows and convert them to dense vectors using off-the-shelf models. In some embodiment, such processing focuses on text such a function names, comments, variable names, etc., and off-the-shelf language models (like BERT) are used to generate embeddings. The embeddings are stored in the code database <NUM>, often with the help of a cube extension.

Several Dvatalog-based program analyses are run using the data in code database <NUM>. This may include things like computing aliasing information, flow edges, building a call graph, etc..

Back in the code notebook <NUM>, a user may execute cells with queries composed using the query API <NUM>. When cells in the notebook <NUM> are executed, some embodiments use a custom kernel and VISUAL STUDIO® Code extension to support things like rendering specialized (and interactive) output The interactive output rendering is used, initially, for things like setup and configuration and also later during querying to render clickable results that jump to relevant locations in the target code base. Results are shown directly in the code representation <NUM> of the program source code <NUM> (e.g., highlighting, bolding, italicizing, underlining, changing color, or otherwise indicating source ranges or rendering other in-line elements.

<FIG> illustrates an example of the code notebook UI <NUM> for submitting code queries and viewing query results, according to some of the disclosed embodiments. The code notebook UI <NUM> displays the bookmark are <NUM>, the query window <NUM>, and the code representation <NUM>. The query window <NUM> provides an area for the user <NUM> to submit code queries for testing the source code <NUM>. As previously discussed, the code queries submitted through the query window <NUM> are transmitted and queried against the code database <NUM> created from the remote build <NUM> of the source code <NUM>. Query results are transmitted back to the client computing device <NUM> and shown in the code representation <NUM>, e.g., through highlighting, italicizing, color changing, or otherwise being visually modified. Also, the bookmark area <NUM> provides links for the user <NUM> to jump directly to the various query results that are returned.

<FIG> shows the notebook <NUM> with different queries being run, according to some of the disclosed examples. Query <NUM> is a semantic search tor variables that are semantically similar to "options. " Query <NUM> is a structural query for variables that are used more than ten times in the source code.

Query results are returned and instances of the query results are highlighted in the code representation <NUM>, at points <NUM>, <NUM>, <NUM>, and <NUM>. As can be seen, the term "config" was identified as being semantically equivalent to "settings" (meeting the semantic query) in response to query <NUM>. Query <NUM> looked for a namespace like "settings," and (though not shown) results were returned that identified namespace "config," broken down into the declarations defined within that namespace, and then found all usages of the declarations in the namespace with a name similar to settings. These instances <NUM>-<NUM> show the user <NUM> the query results in the code representation <NUM>, and each instance (in some embodiments) is bookmarked in the bookmark area <NUM> for easy access. Thus, the user <NUM> submits a query of semantic, structural, and/or program flow operations, is able to view the query results directly in the source code <NUM> and is also provided bookmark links to quickly jump to the various query results.

The user <NUM> may query the source code <NUM>-via the code database <NUM>-with only semantic queries, only structural queries, or only flow queries. In particular, the semantic queries allow the user to only submit fuzzy logic of terms to be searched, and the disclosed embodiments semantically expand the submitted terms to find other text that is considered synonymous, or semantically equivalent.

Thus, the code notebook UI <NUM> provides an interactive notebook experience that allows the user <NUM> to submit code queries and get code results directly in the code representation <NUM>. In some embodiments, the code representation <NUM> also provides editing functionality, allowing the user <NUM> to directly edit the source code <NUM>. This ability to intelligently search, find, and directly edit the source code <NUM> is far more helpful to a developer compared to traditional tools for code analysis.

<FIG> illustrate UIs of other embodiments of the code notebook UI <NUM>. In the depicted examples, the code notebook UI <NUM> shows a counter value <NUM> that indicates how many code results are found in the code database <NUM> for a give code query. Looking at <FIG>, the user submitted a code query <NUM> for code elements similar to "cache" with file names that contain "inval. " Counter value <NUM> reveals that <NUM> results were returned, and the results <NUM> are shown and emphasized in both the query window <NUM> and the data representation <NUM>. Similar code searches <NUM> and <NUM> are shown in <FIG> and <FIG>, respectively. Respective counter values <NUM> and <NUM> and code results <NUM> and <NUM> are illustrated as well.

<FIG> illustrates a flowchart diagram of a workflow <NUM> for creating the code database <NUM> of the source code <NUM>, according to some of the disclosed examples. As shown at <NUM>, the local build <NUM> of the source code <NUM> is received in the cloud-computing environment <NUM> from the client computing device <NUM>. The user <NUM> may upload the local build <NUM> of the source code <NUM> to the cloud-computing environment <NUM>, either directly through the code notebook <NUM> or through an online service for code ingestion. The cloud-computing environment <NUM> has one or more servers or VMs that are configured to create the remote build <NUM> of the source code <NUM>, as shown at <NUM>. The middleware <NUM> creates the code database <NUM> from the remote build <NUM>, as shown at <NUM>. Alternatively, the code database <NUM> may be created until after the remote build <NUM> has been analyzed for semantic equivalences, code structures, and flow operations. In other words operation <NUM> may be performed after the depicted decision boxes <NUM>-<NUM>.

As shown at <NUM>-<NUM>, that the source code <NUM>-via the remote build <NUM> or the code database <NUM>-is analyzed to identify semantic equivalences, code structures, and program flows. In other words, the semantic analyzer <NUM>, structure analyzer <NUM>, and flow analyzer <NUM> are run to examine and identify the structure, flow, and equivalent text of the source code <NUM>. Workflow <NUM> shows one embodiment in which these three operations-identification of semantic equivalences by the semantic analyzer <NUM>, code structures by the structure analyzer <NUM>, and flow operations by the flow analyzer <NUM>-are performed in parallel. Alternatively, they may be sequentially performed.

Embeddings are created for the semantic equivalences, code structures, and flow operations that are identified, as shown at <NUM>. Such embeddings of the semantic equivalences, code structures, and flow operations are stored in the code database <NUM>, as shown at <NUM>. Thus, the code database <NUM> includes a searchable database (e.g., SQL) with the machine learned semantic equivalences, code structures, and flow operations identified against which the user <NUM> may run powerful code queries.

<FIG> illustrates a flowchart diagram of a workflow <NUM> for executing the code notebook <NUM> on the client computing device <NUM> that allows the user <NUM> to submit powerful code queries on the source code <NUM> and view query results directly in the source code <NUM>, according to some of the disclosed embodiments. As shown at <NUM>, the code notebook UI <NUM> is presented to the user <NUM> on the client computing device <NUM>. As shown at <NUM>, the user <NUM> may submit a code query in the query window <NUM>, specifying any combination of semantic, code structure, and/or operation flow search terms. When a code query is entered and submitted in the query window <NUM>, the code query is submitted to the query service <NUM> operating on the servers or VMs of the cloud-computing environment <NUM>, as shown at <NUM>. The query service <NUM> runs the submitted query on the code database <NUM>, as shown at <NUM>. Query results are identified, as shown at <NUM>, as transmitted back to the client computing device <NUM>, as shown at <NUM>.

The code notebook <NUM> visually indicates (e.g., highlighting, bolding, changing color) the query results in the code representation <NUM> of the source code <NUM> to make the query results apparent to the user <NUM>, as shown at <NUM>. Additionally, bookmarks links are generated and presented in the bookmark area <NUM> of the code notebook UI <NUM> to allow the user <NUM> to quickly jump to different query results in the source code, as shown at <NUM>.

Thus, the code notebook UI <NUM> provides an area to submit queries (query window <NUM>), view query results directly in the source code (code representation <NUM>), and jump to different query results in the source code <NUM> (bookmark area <NUM>). Combined with the ability to submit powerful code queries that analyze the source code with fuzzy logic, the disclosed embodiments provide a robust code-analysis tool that allows for queries for more generalized searches to be conducted and expanded by backend machine learning while at the same time enabling a user to quickly search for and view code query results directly in a single client-side application.

<FIG> illustrates a block diagram of one example of a cloud-computing environment <NUM>, in accordance with some of the disclosed embodiments. Cloud-computing environment <NUM> includes a public network <NUM>, a private network <NUM>, and a dedicated network <NUM>. Public network <NUM> may be a public cloud-based network of computing resources, for example. Private network <NUM> may be a private enterprise network or private cloud-based network of computing resources. And dedicated network <NUM> may be a third-party network or dedicated cloud-based network of computing resources.

Hybrid cloud <NUM> may include any combination of public network <NUM>, private network <NUM>, and dedicated network <NUM>. For example, dedicated network <NUM> may be optional, with hybrid cloud <NUM> comprised of public network <NUM> and private network <NUM>.

Public network <NUM> may include data centers configured to host and support operations, including tasks of a distributed application, according to the fabric controller <NUM>. It will be understood and appreciated that data center <NUM> and data center <NUM> shown in <FIG> are merely examples of suitable implementations for accommodating one or more distributed applications, and are not intended to suggest any limitation as to the scope of use or functionality of examples disclosed herein. Neither should data center <NUM> and data center <NUM> be interpreted as having any dependency or requirement related to any single resource, combination of resources, combination of servers (e.g., servers <NUM> and <NUM>) combination of nodes (e.g., nodes <NUM> and <NUM>), or a set of application programming interfaces (APIs) to access the resources, servers, and/or nodes.

Data center <NUM> illustrates a data center comprising a plurality of servers, such as servers <NUM> and <NUM>. A fabric controller <NUM> is responsible for automatically managing the servers <NUM> and <NUM> and distributing tasks and other resources within the data center <NUM>. By way of example, the fabric controller <NUM> may rely on a service model (e.g., designed by a customer that owns the distributed application) to provide guidance on how, where, and when to configure server <NUM> and how, where, and when to place application <NUM> and application <NUM> thereon. One or more role instances of a distributed application may be placed on one or more of the servers <NUM> and <NUM> of data center <NUM>, where the one or more role instances may represent the portions of software, component programs, or instances of roles that participate in the distributed application. In other examples, one or more of the role instances may represent stored data that are accessible to the distributed application.

Data center <NUM> illustrates a data center comprising a plurality of nodes, such as node <NUM> and node <NUM>. One or more virtual machines may run on nodes of data center <NUM>, such as virtual machine <NUM> of node <NUM> for example. Although <FIG> depicts a single virtual node on a single node of data center <NUM>, any number of virtual nodes may be implemented on any number of nodes of the data center in accordance with illustrative embodiments of the disclosure. Generally, virtual machine <NUM> is allocated to role instances of a distributed application, or service application, based on demands (e.g., amount of processing load) placed on the distributed application. As used herein, the phrase "virtual machine," or VM, is not meant to be limiting, and may refer to any software, application, operating system, or program that is executed by a processing unit to underlie the functionality of the role instances allocated thereto. Further, the VMs <NUM> may include processing capacity, storage locations, and other assets within the data center <NUM> to properly support the allocated role instances.

In operation, the virtual machines are dynamically assigned resources on a first node and second node of the data center, and endpoints (e.g., the role instances) are dynamically placed on the virtual machines to satisfy the current processing load. In one instance, a fabric controller <NUM> is responsible for automatically managing the virtual machines running on the nodes of data center <NUM> and for placing the role instances and other resources (e.g., software components) within the data center <NUM>. By way of example, the fabric controller <NUM> may rely on a service model (e.g., designed by a customer that owns the service application) to provide guidance on how, where, and when to configure the virtual machines, such as VM <NUM>, and how, where, and when to place the role instances thereon.

As described above, the virtual machines may be dynamically established and configured within one or more nodes of a data center. As illustrated herein, node <NUM> and node <NUM> may be any form of computing devices, such as, for example, a personal computer, a desktop computer, a laptop computer, a mobile device, a consumer electronic device, a server, and like. VMs machine(s) <NUM>, while simultaneously hosting other virtual machines carved out for supporting other tenants of the data center <NUM>, such as internal services <NUM>, hosted services <NUM>, and storage <NUM>. Often, the role instances may include endpoints of distinct service applications owned by different customers.

In some embodiments, the hosted services <NUM> include the previously discussed middleware <NUM>, the embedder <NUM>, and the query service <NUM>. These services operate to create, maintain, and query the code database <NUM>, which may be stored and hosted in the public network <NUM>, the private network <NUM>, or the dedicated network <NUM>, as well as any combination thereof.

Typically, each of the nodes include, or is linked to, some form of a computing unit (e.g., central processing unit, microprocessor, etc.) to support operations of the component(s) running thereon. As utilized herein, the phrase "computing unit" generally refers to a dedicated computing device with processing power and storage memory, which supports operating software that underlies the execution of software, applications, and computer programs thereon. In one instance, the computing unit is configured with tangible hardware elements, or machines, that are integral, or operably coupled, to the nodes to enable each device to perform a variety of processes and operations. In another instance, the computing unit may encompass a processor (not shown) coupled to the computer-readable medium (e.g., computer storage media and communication media) accommodated by each of the nodes.

The role of instances that reside on the nodes may be to support operation of service applications, and thus they may be interconnected via APIs. In one instance, one or more of these interconnections may be established via a network cloud, such as public network <NUM>. The network cloud serves to interconnect resources, such as the role instances, which may be distributed across various physical hosts, such as nodes <NUM> and <NUM>. In addition, the network cloud facilitates communication over channels connecting the role instances of the service applications running in the data center <NUM>. By way of example, the network cloud may include, without limitation, one or more communication networks, such as LANs and/or wide area networks WANs. Such communication networks are commonplace in offices, enterprise-wide computer networks, intranets, and the Internet, and therefore need not be discussed at length herein.

The examples and embodiments disclosed herein may be described in the general context of computer code or machine-useable instructions, including computer-executable instructions such as program components, being executed by a computer or other machine, such as a personal data assistant or other handheld device. Generally, program components including routines, programs, objects, components, data structures, and the like, refer to code that performs particular tasks, or implement particular abstract data types. The disclosed examples may be practiced in a variety of system configurations, including personal computers, laptops, smart phones, mobile tablets, hand-held devices, consumer electronics, servers, VMs, specialty computing devices, etc. The disclosed examples may also be practiced in distributed computing environments where tasks are performed by remote-processing devices that are linked through a communications network.

By way of example and not limitation, computer readable media comprise computer storage media devices and communication media. Computer storage media devices include volatile and nonvolatile, removable and non-removable memory implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules, or the like. Computer storage media devices are tangible and mutually exclusive to communication media. Computer storage media devices are implemented in hardware and exclude carrier waves and propagated signals. Computer storage media devices for purposes of this disclosure are not signals per se. Example computer storage media devices include hard disks, flash drives, solid-state memory, phase change random-access memory (PRAM), static random-access memory (SRAM), dynamic random-access memory (DRAM), other types of random-access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information for access by a computing device. In contrast, communication media typically embody computer readable instructions, data structures, program modules, or the like in a modulated data signal such as a carrier wave or other transport mechanism and include any information delivery media.

Some embodiments are directed to a method for presenting a code notebook that allows a user to enter a code query regarding program source code that is executed in a cloud-computing environment and see query results to the code query. The method comprises: presenting a UI of the code notebook on a client computing device, the UI comprising a query window for receiving the code query from the user and a representation of the program source code modified based on the query results; receiving the code query from the user in the query window; submitting the code query to one or more servers of the cloud-computing environment for running the code query on the program source code in the cloud-computing environment to generate the query results; receiving the query results generated from the one or more servers querying the program source code; and showing at least one of the query results in the representation of the program source code in the user interface (UI) of the code notebook on a client computing device.

In some embodiments, the code query comprises a first code element requested for searching and the at least one of the query results comprise a second code element determined to be semantically equivalent to the first code element of the code query.

Some embodiments also include determining the second code element is semantically equivalent to the first code element by applying a machine-learning algorithm that analyzes sets of text on the World Wide Web.

Some embodiments also include providing one or more application programming interfaces (APIs) as part of the code notebook for enabling the user to have the code query run by the one or more servers. In some embodiments, wherein the query results in the representation of the program source code comprises are highlighted, bolded, italicized, underlined, or changed in color.

Some embodiments also include displaying one or more bookmark links to the query results in the representation of the program source code presented in the UI of the code notebook on the client computing device.

Some embodiments also include generating a local build of the program source code for transmission to the one or more server. Other embodiments do not need the full build, and only transfer the structured data, not the object files.

Some embodiments also include receiving the program source code at the one or more servers and generating a remote build of the program source code on the one or more servers; and creating a code database of the program source code from the remote build.

Some embodiments also include creating a code database of the program source code on the one or more servers; analyzing text of the program source code; identifying semantic equivalences of the analyzed text in the program source code; creating embeddings to add to the code database indicative of the semantic equivalences of the analyzed text; and storing the embeddings in the code database.

Some embodiments also include receiving the code query at the one or more servers; querying the code database with the code query; identifying at least one different text of the program source code that is semantically equivalent to text of the code query based on the embeddings stored in the code database; and including the at least one different text of the source code.

Some embodiments also include creating a code database of the program source code on the one or more servers; identifying structural code elements in the program source code; creating embeddings to add to the code database indicative of the structural code elements; and storing the embeddings in the code database.

Some embodiments also include receiving the code query at the one or more servers; querying the code database with the code query; identifying at least one of the structural code elements in the program source code from the code database; and including the at least one of the structural code elements in the query results.

In some embodiments, the code query specifies a structural search for a particular code structure and a semantic search for particular code text.

In some embodiments, the code query specifies a structural search for a particular operational workflow and a semantic search for particular code text.

In some embodiments, the query results comprise at least one semantic equivalent of text in the code query identified in at least one code structural element of the program source code.

Other embodiments are directed to a client computing device configured to present a code notebook that allows a user to enter a code query regarding program source code and see query results of the code query in a representation of the program source code. The client computing device comprises: memory embodied with executable instructions for presenting a user interface (UI) of the code notebook, the UI comprising a query window for receiving the query from the user and the representation of the program source code modified based on the results to the query; and at least one processor programmed to: present the UI of the code notebook, receive the code query from the user in the query window, submit the query to one or more servers for running the query on the program source code in a cloud-computing environment to generate the query results; receive the query results from the one or more servers, and show at least one of the results in the representation of the program source code in the UI of the code notebook, wherein the query results include at least one code variable that differs from the one or more code variables of the code query and that was deemed to be semantically equivalent by the one or more servers.

In some embodiments, the code query comprises a request to search for the first code element , or any code element, in a code structural element, and the query results comprise identification of the second code element within the code structural element in the program source code.

Other embodiments are directed to a method for performing operations to ingest program source code into a cloud-computing environment and querying the program source code in response to code queries received from a client computing device. The operations comprise: receiving the program source code from a client computing device; analyzing the program source code to identify semantically equivalent text and code structural elements in the program source code; creating a code database of the program source code; creating one or more embeddings for the code database indicative of the identified semantically equivalent text and the code structural elements in the program source code; and storing the one or more embeddings with the code database for use in querying the program source code.

Some embodiments also include: receiving a code query submitted by a user, the code query requesting a search for a first code element ; querying the code database for the code query; identifying, from the embeddings, that the first code element of the code query is semantically equivalent to a second code element that is not indicated in the code query; and providing the second code element as a query result to the client computing device.

The order of execution or performance of the operations in examples of the disclosure illustrated and described herein is not essential, and may be performed in different sequential manners in various examples.

Claim 1:
A method for presenting a code notebook (<NUM>) that allows a user to enter a code query regarding program source code (<NUM>) that is executed in a cloud-computing environment (<NUM>) and see query results to the code query, the method comprising:
presenting (<NUM>) a user interface (<NUM>), UI, of the code notebook on a client computing device, the UI comprising a query window (<NUM>) for receiving the code query from the user and a representation (<NUM>) of the program source code modified based on the query results;
receiving (<NUM>) the code query from the user in the query window, the code query comprising a combination of a semantic search for semantically equivalent code elements and a structural query, wherein the semantic search comprises a first code element being a query term and the structural query refers to a structural code element defining a structure of the program source code in which the first code element is to be searched, such as declarations, code operations for loops, if/then statements or operational counts;
submitting (<NUM>) the code query to one or more servers of the cloud-computing environment for running (<NUM>) the code query on the program source code in the cloud-computing environment to generate query results, the query results comprising a second code element determined to be semantically equivalent to the first code element of the code query and found in the structure of the program source code defined by the structural code element, wherein semantical equivalency between code elements is determined based on encoded distances in a learned latent space;
receiving the query results generated from the one or more servers querying the program source code; and
showing (<NUM>) at least one of the query results in the representation of the program source code in the UI of the code notebook on a client computing device (<NUM>).