Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Beggining the compiler journey

Reply
Thread Tools

Beggining the compiler journey

 
 
Rafael Rosa
Guest
Posts: n/a
 
      12-13-2008
Hi,

I've being working with computer's for 13+ years, but I classify myself
as a good high-level (as in high abstraction) programmer, with a
business logic focus. As such I don't have any relevant knowledge about
low level stuff, except the big picture ideas like what's a compiler,
bytecode, process, threads, etc, I never studied the actual
implementation of those things.

Now I wish to take a dive and learn this stuff, but I'm having a hard
time finding a good global guide. I'm looking for a book, a tutorial, or
anything like that, that can explain the differences between the
architecture for a language used with a VM and another without, what's
the impact of these choices when building a compiler, how low level
memory management works, what's the current trend, etc.

I've navigated Wikipedia and Google, and started to read Jack Crenshaw's
compiler tutorial, and though I like the hands-on approach (specially
the use of Pascal), and think that's it's a nice first-timer stuff, it
assumes the reader knows how to read assembly language and how to work
with stack stuff. Another thing is that it's not designed to work with
pré-8080 processors and I'm pretty sure there's a world of differences
between that and current technologies, like multi-core processors.

I've also started to read Niklaus Wirth "Compiler Construction" and it's
really, really nice, but it also assumes the reader knows a lot of stuff
that I don't. I can understand the basics of it, but can't understand
the details, so I need more info.

Anyway, I'm looking for a good guide to help me find my way. I'm not
planning to become a compiler expert or really understand the complex
math behind all of it, I just want to have a geek hobby and have a
understanding of what's going on behind the curtains. If anyone can
recommend me a good companion for Wirth's work, I'd be very happy. Stuff
in Portuguese, French or Spanish, and of course English, is welcome.

By the way, I'm asking this kind of stuff on a Ruby list because I want
to play with Ruby language stuff, so I thought it would be better to be
around the appropriate folks. I've even downloaded Ruby's source but I
have no idea of where to start reading it

Thanks a lot,
Rafael.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Jens Wille
Guest
Posts: n/a
 
      12-13-2008
hi rafael!

Rafael Rosa [2008-12-13 16:58]:
> Now I wish to take a dive and learn this stuff, but I'm having a
> hard time finding a good global guide. I'm looking for a book, a
> tutorial, or anything like that, that can explain the differences
> between the architecture for a language used with a VM and
> another without, what's the impact of these choices when building
> a compiler, how low level memory management works, what's the
> current trend, etc.

maybe "Programming Language Pragmatics" by Michael L. Scott can give
you some hints. it might not be a perfect fit for your needs,
though. just thought i'd throw it in... i'm coming from a totally
different background but i really enjoy reading it.

<http://www.cs.rochester.edu/~scott/pragmatics/>

> By the way, I'm asking this kind of stuff on a Ruby list because
> I want to play with Ruby language stuff, so I thought it would be
> better to be around the appropriate folks. I've even downloaded
> Ruby's source but I have no idea of where to start reading it

the README.EXT file might be a good starting point.

cheers
jens

--
Jens Wille, Dipl.-Bibl. (FH)
prometheus - Das verteilte digitale Bildarchiv für Forschung & Lehre
Kunsthistorisches Institut der Universität zu Köln
Albertus-Magnus-Platz, D-50923 Köln
Tel.: +49 (0)221 470-6668, E-Mail: http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.prometheus-bildarchiv.de/

 
Reply With Quote
 
 
 
 
Rafael Rosa
Guest
Posts: n/a
 
      12-13-2008
Hi Jens.

Thanks for the link, I've read the Preface and the took a peek on the
index and it seems to be very very close to what I'm looking for, thanks
a lot.

As for the readme, I did read it, but it didn't explain how to
understand how the compiler code is organized, and I didn't expect it to
do so Without understanding how things should be arranged is very
hard to look at all those C files and make sense of what's going on,
specially when you don't know C

I've also found some interesting stuff at http://www.antlr.org/, even a
Ruby command dictionary, very nice. It will be even more interesting
when I know what to do next

Thanks a lot, I keep studding.
Rafael.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Jens Wille
Guest
Posts: n/a
 
      12-13-2008
Rafael Rosa [2008-12-14 00:42]:
> Thanks for the link, I've read the Preface and the took a peek on
> the index and it seems to be very very close to what I'm looking
> for, thanks a lot.

great.

> As for the readme, I did read it, but it didn't explain how to
> understand how the compiler code is organized, and I didn't
> expect it to do so Without understanding how things should be
> arranged is very hard to look at all those C files and make sense
> of what's going on,

yeah, sure. but i had the impression that it provides some places to
start with among the many files there are. btw, do you know the Ruby
Hacking Guide?

<http://rhg.rubyforge.org/>

and the Integrated Ruby Hacker's Guide

<http://www.hawthorne-press.com/WebPage_RHG.html>

> specially when you don't know C

i can feel that

> I've also found some interesting stuff at http://www.antlr.org/,
> even a Ruby command dictionary, very nice. It will be even more
> interesting when I know what to do next

unfortunately, i'm probably not the right person to help you there,
sorry. but i'm interested in whatever more experienced people might
have to tell you about it.

cheers
jens

 
Reply With Quote
 
Martin DeMello
Guest
Posts: n/a
 
      12-14-2008
On Sat, Dec 13, 2008 at 9:28 PM, Rafael Rosa <(E-Mail Removed)> wrote:
>
> Now I wish to take a dive and learn this stuff, but I'm having a hard
> time finding a good global guide. I'm looking for a book, a tutorial, or
> anything like that, that can explain the differences between the
> architecture for a language used with a VM and another without, what's
> the impact of these choices when building a compiler, how low level
> memory management works, what's the current trend, etc.
>


Take a look at http://www.hokstad.com/writing-a-com...up-step-1.html

martin

 
Reply With Quote
 
Rafael Rosa
Guest
Posts: n/a
 
      12-14-2008
Jen and Martin,

Thanks to both of you, these links are very useful indeed. I'll dig into
them as soon as finish a paper I'm working on. The compiler building is
very very interesting, and it's seems to be quite accessible too. If
everything goes as I expect I'll publish my learning notes somewhere,
and I'll let you know.

Thanks a lot,
Rafael.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
William Rutiser
Guest
Posts: n/a
 
      12-14-2008
Rafael Rosa wrote:
> Jen and Martin,
>
> Thanks to both of you, these links are very useful indeed. I'll dig into
> them as soon as finish a paper I'm working on. The compiler building is
> very very interesting, and it's seems to be quite accessible too. If
> everything goes as I expect I'll publish my learning notes somewhere,
> and I'll let you know.
>
> Thanks a lot,
> Rafael.
>

Topher Cyil's book, "Practical Ruby Projects", has a chapter on parsing
in Ruby.

You may wish to consider implementing a simple interpreter before a
compiler. This would let you see something happening sooner. The parsing
part could be common to both. Some compilers for some languages rely
heavily on an interpreter disguised as a run-time library.

Have fun,
Bill

 
Reply With Quote
 
Ryan Davis
Guest
Posts: n/a
 
      12-15-2008

On Dec 14, 2008, at 12:47 , William Rutiser wrote:

> You may wish to consider implementing a simple interpreter before a
> compiler. This would let you see something happening sooner. The
> parsing part could be common to both. Some compilers for some
> languages rely heavily on an interpreter disguised as a run-time
> library.


agreed.

and I'd also recommend sticking to wirth's book. It is very very
terse, but a great book. Start with parsing, add an interpreter, and
move to compiling as your final step.

The ruby compiler link in this thread is interesting in that it starts
from the bottom and works its way up. That might help or hinder
depending on your learning style.

Last thing, I'd stick to doing the simplest compiler you can for your
first one, and not worry about a lot of the issues you brought up in
your original email. Books like Hennessy & Patterson's Computer
Architecture book and some of the newer texts on VM design will cover
those edge cases very well.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HEAP ALLOCATION, not at the beggining, in the MIDLE of running Paul K. Java 2 12-09-2006 06:56 PM
HEAP ALLOCATION, not at the beggining, in the MIDLE of running Paul K. Java 0 12-08-2006 11:17 PM
HEAP ALLOCATION, not at the beggining, in the MIDLE of running Paul K. Java 0 12-08-2006 11:17 PM
Long Day's Journey Into Printers . . . PTRAVEL Digital Photography 6 08-03-2003 03:30 PM



Advertisments