请帮助一个n00b写一个编译器:-) [英] Please help a n00b write a compiler :-)

查看:77
本文介绍了请帮助一个n00b写一个编译器:-)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


如果我想为我发明的玩具C类似语言写一个编译器,我会从哪里开始寻求建议(或者,更确切地说,我正处于发明的过程中)。是的,是的,我知道我疯了,这个想法就是

脑损伤等等。很有可能我很久就会失去兴趣

我达到收支平衡,但这并没有伤害尝试,是吗?


我是C上瘾者不愿意切换到C ++,部分原因是因为我不能完全支持(并接受)OOP范例。不过我喜欢C ++的可论证的

改进,比如函数和运算符的重载,引用,

const类型等等。我也很想念Pascal的无路径 - 隐藏的typedef和

一致的数组类型。


我想这不是从头开始编写我的实验编译器

它可能是一个更好的想法,采取现有的,并将其破解为理想的多用途语言的概念。我有一些经验

使用QuakeC(游戏Quake的字节码编译器)所以我知道什么是非常简单的编译器看起来像是什么,但是像解析和处理这样的东西

复合数据类型和x86机器代码的生成仍然超出我的理解。


我看过了海湾合作委员会的消息来源曾经被吓死了。

显然它是一个非常先进,可扩展和可移植的编译器,而这需要相当多的不必要的复杂性。


是否有类似为傻瓜编写编译器的艺术??是

有一个简单的C编译器,哪个源可以在

a GPL兼容许可下使用?


任何帮助表示赞赏。


BR,

Anton''Tonik''Gavrilov

解决方案

Anton Gavrilov写道:

感谢任何帮助。



http://google.com/groups?group=comp.compilers


试用Flex(LEX)( http://www.gnu.org/software/flex / )和Bison(YACC)

http://www.gnu.org/software/bison/bison.html)

祝你好运!


Seth


Anton Gavrilov写道:

大家好,

如果我想为我发明的玩具C语言编写编译器(或者更确切地说,是在发明过程中),我会从哪里开始寻求建议。是的,是的,我知道我疯了,这个想法是脑损伤的。很可能我很久就会失去兴趣
我达到了收支平衡,但它没有伤害尝试,是吗?

我是一个不愿意转向C ++的瘾君子,部分是因为我不能完全接受(并接受)OOP范式。不过我喜欢C ++的可论证的改进,比如函数和运算符的重载,引用,const类型等等。我也想念Pascal'的方式 - 隐藏式的typedef和
一致数组类型。

我认为不是从头开始编写我的实验编译器
这可能是一个更好的主意,采取一个现有的编译器并将其破解为我的概念''理想的多用途语言''。我有一些使用QuakeC(游戏Quake的字节码编译器)的经验,所以我知道什么是非常简单的编译器,但是解析和处理复合数据类型之类的东西x86机器代码的生成仍然超出了我的理解。

我曾经看过一次GCC源,并被吓死了。
显然它是非常先进的,可扩展和可移植的编译器和
这意味着相当多的不必要的复杂性。

是否有类似为傻瓜编写编译器的艺术??是否有一个简单的C编译器,哪个源可以与GPL兼容的许可证获得?

任何帮助都表示赞赏。

BR,
Anton''Tonik''Gavrilov




~让我们linux~

----- =通过新闻源发布。 Com,Uncensored Usenet News = -----
http://www.newsfeeds.com - 世界排名第一的新闻组服务!

----- ==超过100,000个新闻组--19个不同的服务器! = -----


2003年12月18日星期四13:15:38 GMT,Anton Gavrilov< sp ***** @ fromru.com>

写道:

大家好,

如果我想为<编写编译器,我会从哪里开始寻求建议我发明了玩具C语言(或者更确切地说,我正在进行



试试这个:
http://compilers.iecc.com/crenshaw/


-

Al Balmer

Balmer Consulting
re ************************ @ att.net


Hi all,

I seek your advice on where to start if I want to write a compiler for a
toy C-like language I invented (or, rather, am in the process of
inventing). Yes, yes, I know I''m crazy and the very idea is
brain-damaged and all that. Chances are I will lose interest long before
I reach break-even, but it doesn''t hurt trying, does it?

I''m a C addict reluctant to switch to C++, partly because I can''t fully
grok (and accept) the OOP paradigm. Nevertheless I like C++''s arguable
improvements such as overloading of functions and operators, references,
const types etc. I also miss Pascal''s way-less-cryptic typedefs and
consistent array types.

I suppose that rather than writing my experimental compiler from scratch
it might be a better idea to take an existing one and hack it towards my
notion of ''the ideal multi-purpose language''. I had some experience
with QuakeC (a byte-code compiler for the game Quake) so I know what a
very simple compiler looks like, but things like parsing and handling of
composite data types and generation of x86 machine code are still beyond
my understanding.

I have taken a look at GCC source once and was startled to death.
Obviously it''s a highly advanced, extendible and portable compiler and
this implies quite a lot of unnecessary complexity.

Is there something like ''The Art of Writing Compilers for Dummies?''? Is
there a simple C compiler somewhere for which source is available under
a GPL-compatible license?

Any help is appreciated.

BR,
Anton ''Tonik'' Gavrilov

解决方案

Anton Gavrilov wrote:

Any help is appreciated.



http://google.com/groups?group=comp.compilers


Try Flex (LEX) (http://www.gnu.org/software/flex/) and Bison (YACC)
(http://www.gnu.org/software/bison/bison.html).
good luck!

Seth

Anton Gavrilov wrote:

Hi all,

I seek your advice on where to start if I want to write a compiler for a
toy C-like language I invented (or, rather, am in the process of
inventing). Yes, yes, I know I''m crazy and the very idea is
brain-damaged and all that. Chances are I will lose interest long before
I reach break-even, but it doesn''t hurt trying, does it?

I''m a C addict reluctant to switch to C++, partly because I can''t fully
grok (and accept) the OOP paradigm. Nevertheless I like C++''s arguable
improvements such as overloading of functions and operators, references,
const types etc. I also miss Pascal''s way-less-cryptic typedefs and
consistent array types.

I suppose that rather than writing my experimental compiler from scratch
it might be a better idea to take an existing one and hack it towards my
notion of ''the ideal multi-purpose language''. I had some experience
with QuakeC (a byte-code compiler for the game Quake) so I know what a
very simple compiler looks like, but things like parsing and handling of
composite data types and generation of x86 machine code are still beyond
my understanding.

I have taken a look at GCC source once and was startled to death.
Obviously it''s a highly advanced, extendible and portable compiler and
this implies quite a lot of unnecessary complexity.

Is there something like ''The Art of Writing Compilers for Dummies?''? Is
there a simple C compiler somewhere for which source is available under
a GPL-compatible license?

Any help is appreciated.

BR,
Anton ''Tonik'' Gavrilov



~ Let us linux ~
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


On Thu, 18 Dec 2003 13:15:38 GMT, Anton Gavrilov <sp*****@fromru.com>
wrote:

Hi all,

I seek your advice on where to start if I want to write a compiler for a
toy C-like language I invented (or, rather, am in the process of



Try this:
http://compilers.iecc.com/crenshaw/

--
Al Balmer
Balmer Consulting
re************************@att.net


这篇关于请帮助一个n00b写一个编译器:-)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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