We present stack graphs, an extension of Visser et al.'s scope graphs framework. Stack graphs power Precise Code Navigation at GitHub, allowing users to navigate name binding references both within and across repositories. Like scope graphs, stack graphs encode the name binding information about a program in a graph structure, in which paths represent valid name bindings. Resolving a reference to its definition is then implemented with a simple path-finding search. GitHub hosts millions of repositories, containing petabytes of total code, implemented in hundreds of different programming languages, and receiving thousands of pushes per minute. To support this scale, we ensure that the graph construction and path-finding judgments are file-incremental: for each source file, we create an isolated subgraph without any knowledge of, or visibility into, any other file in the program. This lets us eliminate the storage and compute costs of reanalyzing file versions that we have already seen. Since most commits change a small fraction of the files in a repository, this greatly amortizes the operational costs of indexing large, frequently changed repositories over time. To handle type-directed name lookups (which require "pausing" the current lookup to resolve another name), our name resolution algorithm maintains a stack of the currently paused (but still pending) lookups. Stack graphs can be constructed via a purely syntactic analysis of the program's source code, using a new declarative graph construction language. This means that we can extract name binding information for every repository without any per-package configuration, and without having to invoke an arbitrary, untrusted, package-specific build process.
翻译:我们展示了堆叠图, 是 Visser 等人 的范围图框架的延伸 。 Stack 图形显示在 GitHub 的 Precise Duction 导航工具, 允许用户在库内和跨库中浏览名称约束引用。 像范围图一样, 堆叠图将一个程序的名称约束信息编码在一个图形结构中, 路径代表有效名称绑定。 然后通过简单的路由搜索来解决对其定义的引用 。 GitHub 存储了数百万个仓库, 包含总代码的平方字节, 以数百种不同的程序语言实施, 每分钟接收数千个推键 。 为了支持这个规模, 我们确保图形构建和路由查询的判断是文件库的内含参考文件。 对于每个源, 我们创建了一个孤立的子图解图解, 也可以用一个当前版本的直径解码来构建另一个程序 。 这样可以使用一个正在解析的版本的版本, 也可以使用一个正在解析的版本的版本 。