Re: C compiler from scratch.

s_dubrovich@yahoo.com
Sat, 25 Jul 2009 09:26:48 -0700 (PDT)

          From comp.compilers

Related articles
C compiler from scratch. vikranthit@gmail.com (Vikranth) (2009-07-13)
Re: C compiler from scratch. Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2009-07-15)
Re: C compiler from scratch. gopi.onthemove@gmail.com (gopi) (2009-07-16)
Re: C compiler from scratch. DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-07-18)
Re: C compiler from scratch. s_dubrovich@yahoo.com (2009-07-25)
| List of all articles for this month |
From: s_dubrovich@yahoo.com
Newsgroups: comp.compilers
Date: Sat, 25 Jul 2009 09:26:48 -0700 (PDT)
Organization: Compilers Central
References: 09-07-024
Keywords: C
Posted-Date: 26 Jul 2009 17:43:14 EDT

On Jul 13, 7:40 am, Vikranth <vikrant...@gmail.com> wrote:
> Hi , I am looking for C grammar that is suitable for building a (hand
> written) compiler from scratch.Does the grammar provided in appendix
> of K&R book work? Or any alternatives please?


I took Ron Cain's Small-c, which is written in a subset of K&R C, and
put a nasm backend to it. Small-c is a bootstrap K&R C, a minimalist
K&R C compiler written in its minimalist K&R C. It is a complete
enough K&R C to self compile, without for(;;) and switch(expr) and
struct{}. In other words, the parser parses a subset of K&R C, not
the complete grammar of the appendix. Later on, others expanded
Cain's Small-c to add much of the remaining grammar, and ports to
other OS's.


Anyway, my Small-c project is here:
http://www.project-fbin.hostoi.com/index.htm


I targeted the iolib to use XP's cmd.exe for my convenience.


I recommend you copy all of the site that you want for future
reference, I don't know how long it will be maintained.


Steve



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.