Re: What's lacking: a good intermediate form

Max Hailperin <max@gustavus.edu>
Mon, 02 Mar 2009 09:22:15 -0600

          From comp.compilers

Related articles
[8 earlier articles]
Re: What's lacking: a good intermediate form jon@ffconsultancy.com (Jon Harrop) (2009-02-27)
Re: What's lacking: a good intermediate form james.harris.1@googlemail.com (James Harris) (2009-02-27)
Re: What's lacking: a good intermediate form tony@my.net (Tony) (2009-02-28)
Re: What's lacking: a good intermediate form tony@my.net (Tony) (2009-02-28)
Re: What's lacking: a good intermediate form tony@my.net (Tony) (2009-02-28)
Re: What's lacking: a good intermediate form cr88192@hotmail.com (cr88192) (2009-03-01)
Re: What's lacking: a good intermediate form max@gustavus.edu (Max Hailperin) (2009-03-02)
Re: What's lacking: a good intermediate form cr88192@hotmail.com (cr88192) (2009-03-03)
Re: What's lacking: a good intermediate form james.harris.1@googlemail.com (James Harris) (2009-03-02)
Re: What's lacking: a good intermediate form walter@bytecraft.com (Walter Banks) (2009-03-03)
Re: What's lacking: a good intermediate form tony@my.net (Tony) (2009-03-03)
Re: What's lacking: a good intermediate form comp.lang.misc@inglorion.net (Robbert Haarman) (2009-03-04)
Re: What's lacking: a good intermediate form max@gustavus.edu (Max Hailperin) (2009-03-05)
[19 later articles]
| List of all articles for this month |

From: Max Hailperin <max@gustavus.edu>
Newsgroups: comp.compilers
Date: Mon, 02 Mar 2009 09:22:15 -0600
Organization: Compilers Central
References: 09-02-132 09-02-136 09-02-144 09-03-003
Keywords: code, UNCOL
Posted-Date: 02 Mar 2009 15:29:21 EST

"Tony" <tony@my.net>:
[context: he asked for a good IR, I suggested LLVM]
> I just realized that this is comp.compilers. (Maybe I should post in
> comp.lang.misc, something similar to my OP). I, for anyone who hasn't
> yet noticed, am interested in NOT writing a compiler but rather
> developing my language concepts. (That of course is the major goal,
> but I DO actually want to write the frontend of the compiler for my
> language).


It isn't immediately obvious why your goal includes wring a front end;
if it is just so that you wind up with a working implementation of
your language design, so that you can try things out, then I would
suggest you might build an interpreter instead of a compiler. (See,
for example, Essentials of Programming Languages.) But, if you really
do want to wind up with a compiler for your language, having written
only the front end yourself, then that is precisely the point of
leveraging the LLVM project: they provide the back end for you. I am
very puzzled by your emphatically stated conjunction of two facts:


  (1) You want to stay out of the back end.


  (2) You reject someone else's back end that is usable on a canned,
  black-box basis.


I would have thought that a ready-to-roll back end was exactly what
you needed to avoid learning about how back ends work. (Again,
assuming you really want to wind up with a compiler at the end, rather
than an interpreter.)


> That said, I think assuming that everyone wants to do the
> end-to-end, from source code to machine code thing, happens to much. I
> think a course on language design would be better first than a course
> on compiler implementation. Indeed, some people couldn't care less
> about one or the other.


This part of your email presents another puzzle to me. I don't know
where you got the idea that compiler design typically precedes
language design in course structures. The immediate context of your
post was a reply to mine, in which I had refered to my compiler design
course. That course has a course on principles of programming
languages as a prerequisite. And this is hardly unusual in at least
US colleges and universities.


> The LLVM project seems to be hampered by the lofty goal of being able
> to compile every beastly-to-implement language out there (or at least
> the most beastly one: C++). Yes? Perhaps they are the ones who like
> doing the compiler implementation thing and couldn't care less about
> language design whereas I am more of the opposite.
>
> Tony


This is the third place in one posting where you've got me thoroughly
confused. To the extent you are correct that the LLVM project tries
to make their backend flexible enough to accommodate any language, I
would have thought that this is precisely what a language designer
like you would want -- because it means they are prepared to deal with
whatever you throw at them. If instead they had designed their
backend to work only for their favorite language, then to the extent
your language wasn't simliar, you would be forced to either not use
LLVM or get to know its internals well enough in order to expand its
scope to accommodate your needs, eliminating the ability to use it as
a black box and keep out of back end issues. Or were you thinking
that they would keep it simple by making it support only one kind of
language -- yours? That seems a bit unrealistic, and in any case, if
you really want to engage in language design, your current design is
probably not your last one. If LLVM is flexible, that means it can
accommodate not only your current design, but also the future ones you
are going to try out (some of which may turn out to be dead ends,
quickly scrapped once tried).


Post a followup to this message

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