2

您认为一个人(平均 C++ 经验)是否有可能使用 Erlang 构建非商业 C++ 编译器,可能专注于优化?

我不确定这是否完全不现实?人们有什么建议吗?

erlang 是最好用的语言吗?由于它的模式匹配,我认为它会很好。我不确定它的并发性是否有助于编写编译器?

编辑:原因是我没有在工作中编写 C++ 代码,我想了解更多关于这种语言的知识,因为我对低延迟工作感兴趣。我认为通过编写编译器了解来龙去脉是最好的方法吗?

4

1 回答 1

9

A C++ compiler is a lot of work. No, really, a lot of work. C++ is one of the hardest (if not the hardest) production languages to parse. Even just the front-end. Just try reading the standard, it's more than one thousand pages of dense text.

What do you want to use it for? LLVM has the Clang C/C++ front end and an extremely friendly and well-documented intermediate representation. I suggest you use something like this (from Erlang, appropriately adapted or otherwise) and concentrate on the optimisation stage - leaving the parsing to someone else.

Pattern matching does make for a nice compiler though. So Erlang/F#/Scala/Ocaml/Haskell will shine here.

于 2012-07-10T11:12:41.900 回答