c编译器构造 [英] c compiler construction

查看:89
本文介绍了c编译器构造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种语言更适合创建c编译器.

which languages is more sutaible for creating c compiler.

推荐答案

您最了解的一种语言.

没有用于编写编译器的最佳"语言-它取决于您对编译器的设计要求.
应该尽快吗?至少使用汇编程序或本机代码编译器.
它应该可运输到许多平台吗?使用C或C ++,但避免使用MFC等.
生产应该快吗?然后使用您最了解的任何语言.

通常,这是生产速度与语言/平台支持功能之间的折衷.
交给您!
The one you know best.

There is no "best" language for writing a compiler - it depends on what your design requirements are for the compiler.
Should it be as fast a possible? Use assembler, or a native code compiler at least.
Should it be transportable to many platforms? Use C or C++ but avoid MFC and other such.
Should it be quick to produce? Then use whatever language you know best.

Generally, it is a compromise between speed to produce and language / platform support features.
Over to you!


C/C ++.我在其中编写了所有代码,也许这就是为什么我觉得它适合所有内容.但是,即使其他情况,我也认为C/C ++是比其他人更好的选择.

很多时候,仅因为已经存在的预期功能更易于实现,所以用该语言本身实现一种语言很有用.我的意思是,想象一下在BASIC中实现枚举和指针.

我所见过的唯一用于构建编译器的是Pascal,在Jack Crenshaw的那组邪教文章中.但同样,目标语言是Pascal的子集.
C/C++. I write all my code in that and may be thats why I find it suitable for everything. But even otherwise, I feel C/C++ is a better choice over others.

Many times it is useful to implement a language in that language itself simply because the intended features already being present is simpler to implement. I mean, imagine implementing enums and pointers in BASIC.

The only other one used to build a compiler that I have seen is Pascal in that cult set of articles by Jack Crenshaw. But again, the target language was a subset of Pascal.


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

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