简体   繁体   English

从哪里开始阅读GHC的源代码

[英]Where to start reading GHC's source code

I'm trying to learn how various aspects of GHC, like type inference, pattern matching, and other code transformations, are implemented. 我正在尝试学习如何实现GHC的各个方面,如类型推断,模式匹配和其他代码转换。

However the codebase is fairly large and the file names use a lot of acronyms (simpl, stg, stranal...). 然而,代码库相当大,文件名使用了很多首字母缩略词(简单,stg,stranal ......)。 What do these mean, and how is the code organized? 这些是什么意思,代码是如何组织的?

As hammar says, the GHC commentary is probably the best place to start for learning about GHC itself. 正如哈马尔所说, GHC评论可能是了解GHC本身的最佳起点。 This does assume some prior knowledge of compilers in general, but if your primary interest is in modifying GHC you can probably get by with just a basic CS background. 这确实假设了一般编译器的一些先验知识,但如果你的主要兴趣是修改GHC,你可能只需要基本的CS背景。

If you're interested more generally in the principles behind GHC, eg if you want to learn how to write your own compiler, you'd probably be better served by perusing Simon Peyton-Jones' myriad publications on relevant topics , including an entire book on implementing functional languages and a "tutorial" book that goes through the implementation of a non-strict functional language. 如果您对GHC背后的原则更感兴趣,例如,如果您想学习如何编写自己的编译器,那么通过阅读Simon Peyton-Jones关于相关主题的无数出版物 (包括整本书)可能会更好。 实现函数式语言和贯穿非严格函数式语言实现的“教程”书

GHC评论是一个很好的起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM