关于如何构建C ++编译器的书? [英] book for how to build c++ compiler?

查看:93
本文介绍了关于如何构建C ++编译器的书?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写C ++编译器书?
请帮助我,我想要词法语法&生成codt以构建编译器.
这很重要,因为我在网上搜索它,但是找不到代码,请帮助我

how has book for build c++ compiler?
please help me and i want lexical syntax & generation codt to build compiler.
it is important,because i search about it in the net but i don''t find the code so please help me

推荐答案

有好几本好书有关编写编译器的信息(例如,参见经典的"teoric" 龙书 [弗雷泽和汉森的小说 [ ^ ]).
值得注意的是,构建C++编译器是一项艰巨的任务(C++ 是该死的复杂语言).
There are several good books on writing compilers (see, for instance the classic ''teoric'' Dragon Book[^] or ''more pragmatic'' Fraser and Hanson''s one[^]).
It is worth noting that building a C++ compiler is a daunting task (C++ is a damned complex language).


在人类历史上只有一个人建立了单手C ++编译器Walter Bright [1].所以我什至不会尝试自己.他写了一个C编译器,看到了《 C ++带注释的参考手册》的副本,说这有多难?".几年后,他发现很难,但是有了一个可以正常工作的编译器[2].

如果您需要大脑弯曲理论,请查看CPallini给您的参考.如果您想了解真正的编译器如何工作,请参阅 g ++ [ ^ ].该代码确实很讨厌,但是会向您展示解析C ++所需要做的事情-代码生成实际上很容易!

而且,如果您真的感到很兴奋,Walter Bright将为
There''s only been one person in the history of mankind to have built a C++ compiler single handed, Walter Bright [1]. So I wouldn''t even try yourself. He wrote a C compiler, saw a copy of the C++ Annotated Reference Manual, said "how hard can this be?". A couple of years later he''d found out how hard but had a working compiler [2].

If you want the brain bending theory, have a look at the references CPallini gave you. If you want to see how a real compiler works in all it''s ugly glory have a look at g++[^]. The code is really nasty but will show you the sort of things you have to do to parse C++ - the code generation is actually the easy bit!

And if you''re feeling really flush Walter Bright is selling the source for his C++ compiler for


59 [ ^ ]-如果您是认真的人,可以值得. br/>
无论如何,这里的要点是,如果您想修改C ++编译器以执行某项尚未完成的工作,而g ++并对此进行了破解.如果您要研究编译器的工作方式并实现一个简单的编译器,请从非常容易解析的内容开始,例如 [^ ]

[1]为了解决这一难题,Bjarne Stroustrup在Bright编写Zortech C ++之前就以Cfront的方式编写了代码.但是,那时Stroustrup正在实现许多简单的语言.到AT& T的团队达到与Bright的编译器相同的水平时,其中有四个人正在研究它.

[2]此信息来自2010年4月在ACCU会议上他举办的有关编译器设计的研讨会上的一次个人对话.
59[^] - worth a punt if you''re serious.

Anyway, the point here is if you want to modify a C++ compiler to do something it doesn''t already do grab g++ and hack on that. If you''re trying to research how compilers work and implement a simple one then start with something VERY easy to parse like this.[^]

[1] To head this one off at the pass Bjarne Stroustrup wrote Cfront way before Bright wrote Zortech C++. However Stroustrup was implementing a lot simpler language then. By the time the team at AT&T got to the same level as Bright''s compiler there were four of them working on it.

[2] This information was from a personal conversation in April 2010 at the ACCU conference during a seminar he gave on compiler design.


这篇关于关于如何构建C ++编译器的书?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆