Re: Good practical language and OS agnostic text?

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Thu, 19 Apr 2012 13:53:30 +0200

          From comp.compilers

Related articles
[6 earlier articles]
Re: Good practical language and OS agnostic text? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2012-04-18)
Re: Good practical language and OS agnostic text? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2012-04-18)
Re: Good practical language and OS agnostic text? usenet@rwaltman.com (Roberto Waltman) (2012-04-18)
Re: Good practical language and OS agnostic text? usenet@bitblocks.com (Bakul Shah) (2012-04-18)
Re: Good practical language and OS agnostic text? cr88192@hotmail.com (BGB) (2012-04-19)
Re: Good practical language and OS agnostic text? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2012-04-19)
Re: Good practical language and OS agnostic text? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2012-04-19)
Re: Good practical language and OS agnostic text? compilers@is-not-my.name (2012-04-19)
Re: Good practical language and OS agnostic text? compilers@is-not-my.name (2012-04-19)
Re: Good practical language and OS agnostic text? compilers@is-not-my.name (2012-04-19)
Re: Good practical language and OS agnostic text? torbenm@diku.dk (2012-04-19)
Re: Good practical language and OS agnostic text? compilers@is-not-my.name (2012-04-19)
Re: Good practical language and OS agnostic text? compilers@is-not-my.name (2012-04-19)
[32 later articles]
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Thu, 19 Apr 2012 13:53:30 +0200
Organization: Compilers Central
References: 12-04-019 12-04-023
Keywords: books, parse
Posted-Date: 19 Apr 2012 23:13:22 EDT

Alain Ketterlin schrieb:
> compilers@is-not-my.name writes:
>
>> Guys, I'm having a bear of a time finding a good practical language
>> and OS agnostic text on writing a compiler. I'm weak in math and not
>> interested in the theoretical details. I want to understand the hows
>> and whys of compiler writing. [...]
>
> First, don't expect to understand much of compilation without at least
> some background in discrete maths (some basic language theory, but
> also graph theory if you go down later stages), and of course
> algorithmics and programming.


I dare to disagree. For writing an parser it's sufficient to understand
a formal language definition (BNF...), from which a LL(1) parser can be
even hand-coded. When tools are used to create a compiler skeleton
(lex/yacc, Coco/R, Antlr...), the related math is encapsulated in these
tools, no need that their users bother with it.


IMO the OP will be comfortable with Wirth's books, languages and
compilers, which are understandable even without a big theoretical
background. Even if Wirth is concerned with *teaching* compiler
principles, his languages and compilers are not the toys as many people
believe. E.g. Oberon implements a complete OS, with the compiler being
an integrated part of the entire system. From there it's only a small
step to understanding and implementing e.g. JIT compilers, which require
an different approach from stand-alone compilers.




> Second, don't think compilation is all about language theory. For
> instance, control-flow analysis is heavy on graph traversals, code
> generation may use subtle algorithmics (e.g., dynamic programming), etc.
> And optimization techniques may use whatever will provide a suitable
> model (some loop optimizations make heavy use of linear algebra).
>
> Of course, if you're interested in compilers you'll become interested
> into all the theories/topics they use. And I think it's a very nice way
> to learn a lot about computer science.


Again I suggest the OP to dig into the various (optional) parts of an
compiler later, when he discoverd a *practical* need/motivation for code
flow analysis, register allocation etc. Many people (like me ;-) are
much more open to the theory, when they have practical examples for
their application *before*.


Life is too short for writing an full-blown heavily-optimizing
production compiler from scratch, including its whole RTL. A beginner
IMO is better off with a small language and compiler, where he can study
the related problems, and can find out the areas of his personal interest.


DoDi


Post a followup to this message

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