Related articles |
---|
ARM Compiler f.mardini@gmail.com (foaud167) (2005-01-12) |
Re: ARM Compiler torbenm@pc-032.diku.dk (2005-01-14) |
Re: ARM Compiler iddw@hotmail.com (2005-01-14) |
Re: ARM Compiler f.mardini@gmail.com (foaud167) (2005-01-15) |
Re: ARM Compiler peter.ilberg@ni.com (Peter Ilberg) (2005-01-15) |
Re: ARM Compiler Juergen.Kahrs@vr-web.de (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2005-01-19) |
Re: ARM Compiler boldyrev+nospam@cgitftp.uiggm.nsc.ru (Ivan Boldyrev) (2005-01-22) |
From: | torbenm@pc-032.diku.dk (Torben =?iso-8859-1?q?=C6gidius?= Mogensen) |
Newsgroups: | comp.compilers |
Date: | 14 Jan 2005 00:41:47 -0500 |
Organization: | Department of Computer Science, University of Copenhagen |
References: | 05-01-036 |
Keywords: | design, architecture |
Posted-Date: | 14 Jan 2005 00:41:47 EST |
"foaud167" <f.mardini@gmail.com> writes:
> Lately, I have been considering writing a compiler (just for the heck
> of it). I decided that i will write it in java and produce ARM code,
> but i haven't decided on the input language yet. i am thinking about
> C. Any thoughts would be really great.
The choice of input language depends on what you want to achieve. As
I understand it, it is mostly for the learning experience. This makes
C a bad choice for several reasons:
1) It has an arcane syntax where parsing depends on knowing if a name
is a type name or a variable name and in other cases requires
unbounded lookahead.
2) The semantics of C is ill-defined.
So you would spend most of your time on the front-end and in trying to
figure out what the meaning of certain constructs are. See, for
example, the recent discussion about C compilers on the comp.sys.arm
newsgroup.
So, I would suggest a well-defined language with a simple syntax. You
could choose a suitably simple subset of C or Pascal. Pascal has an
easy-to-parse syntax (it was designed for LL(1) parsing), but some of
its features (nested scopes and procedure parameters) are nontrivial
(though not terribly so) to implement correctly.
You could also pick a language from a compiler textbook, as these are
designed to be relatively simple to compile while still teaching the
most important issues. Good examples of such include the Tiger
language from Andrew Appel's "Modern Compiler Implementation in ..."
books or the Triangle language from Watt & Brown's "Programming
Language Processors in Java".
Torben
Return to the
comp.compilers page.
Search the
comp.compilers archives again.