By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

designing of the compilers

P: n/a

Hi guys! I think all of u know about the designing of
compilers. Can any body tell me about the designing of the compilers.
And also tell me the difference between the compilers and Interpreter
which weresically used by the computers.
I want to know about the basic compiler software.

Dec 15 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
pr*********@gmail.com said:
>
Hi guys! I think all of u know about the designing of
compilers. Can any body tell me about the designing of the compilers.
I suggest you take this up in comp.compilers

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 15 '06 #2

P: n/a
ken
hello pransri
well the design of compilers s very interesting and tough as well
the basic difference between a compiler and an intepretor s that
intereptor will check the code line by line and if u find an error on
one line it will report .only after clearing that u will b able to
proceed
but in the case of compilers it compiles the entire code and finally
reports the errors
if u need to kno the basic consepts of a compiler just try to make a
compiler for a simple language
like a compiler for all four basic arithhamatic expressions.... u can
find this text book very useful for this
Compilers: Principles, Techniques, and Tools (Hardcover) by Alfred V.
Aho, Ravi Sethi, Jeffrey D. Ullman

Dec 15 '06 #3

P: n/a

pr*********@gmail.com wrote:
Hi guys! I think all of u know about the designing of
compilers. Can any body tell me about the designing of the compilers.
And also tell me the difference between the compilers and Interpreter
which weresically used by the computers.
I want to know about the basic compiler software.
We are group users, not Donald Knuths...

Dec 15 '06 #4

P: n/a
pr*********@gmail.com wrote:
>
Hi guys! I think all of u know about the designing of
compilers.
("you". Not "u". Please.)

Why do you think we all know about the designing of compilers? This
is a group about the C programming language. /Some/ of us know (some
stuff) about compilers, but compiler design is rarely topical here.
Can any body tell me about the designing of the compilers.
There are books. Lots of books. You might also try comp.compilers
(fairly formal) or comp.programming (not so formal).
And also tell me the difference between the compilers and Interpreter
which weresically used by the computers.
"weresically"?

(The "difference between compilers and interpreters" is a Flame Zone.)
I want to know about the basic compiler software.
I googled "comp.compilers FAQ" and the first hit was that very FAQ, and it
has suggested books and a link to an introduction (which I can't speak for
since I didn't follow the link). Start there and ask for help in one of
the groups I mention.

--
Chris "Perikles triumphant" Dollin
"I'm still here and I'm holding the answers" - Karnataka, /Love and Affection/

Dec 15 '06 #5

P: n/a
<pr*********@gmail.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.com...
>
Hi guys! I think all of u know about the designing of
compilers. Can any body tell me about the designing of the compilers.
And also tell me the difference between the compilers and Interpreter
which weresically used by the computers.
I want to know about the basic compiler software.
Compiler design at this point in time is a science rather than an art.
Compiling a language involves the theory of finite automata. Essentially, a
finite automaton is a "state machine" with a finite number of states, and
parsing the source code involves using the ordered input stream to drive the
automaton through its states. At any state, if you end up not being able to
make a transition or making an error transition, then the source code is not
a member of the legal language. At this point the parsing and lexical
analysis is all "science".

In fact, YACC is rumored to stand for "yet another compiler compiler".

However, what compiler vendors are less good at is code generation and
optimization. This is science too, but often not applied as well as it can
be.

For starters, here is what may be helpful:

a)Find a local university with a course in finite state automata. Take it.

b)Find a local university with courses in compiler design. Take them.

c)Look up lex and yacc.

d)Search for compiler design textbooks (there are lots of them).

Interpreters have a long history. Most of them are byte-coded for
efficiency.

Here are some URLs:

http://en.wikipedia.org/wiki/Lex_programming_tool

http://en.wikipedia.org/wiki/Parser_generator

http://en.wikipedia.org/wiki/Finite_state_automaton

http://en.wikipedia.org/wiki/Compiler

Dave.

Dec 15 '06 #6

P: n/a
David T. Ashley said:

<snip>
In fact, YACC is rumored to stand for "yet another compiler compiler".
No, it's not a rumour.

Reference: Kernighan and Pike's "The Unix Programming Environment", 1984:
'yacc stands for "yet another compiler-compiler", a comment by its creator,
Steve Johnson, on the number of such programs extant at the time it was
being developed (around 1972). yacc is one of a handful that have
flourished.'

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 15 '06 #7

P: n/a

<pr*********@gmail.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.com...
>
Hi guys! I think all of u know about the designing of
compilers. Can any body tell me about the designing of the compilers.
And also tell me the difference between the compilers and Interpreter
which weresically used by the computers.
I want to know about the basic compiler software.

A commonsense, though not technical, difference is that a compiler turns
source code into machine code, whilst an interpreter runs a program that
calculates the program at run time.
Interpreters are much easier to write than compilers. if you are interested
in how to write interpreters, there is one on my website. There is also a
book to go with it.

A compiler is a rather difficult thing to write. To compile a langage like
C, the basic ide is that you convert expressions to reverse Polish notation.
So (a + b) * c becomes

a,b , + c, *

Thgis can then be converted to push a, push b, pop top pop top, add, push
result, push c, pop top pop top, multiply, push result, which can be
rewritten quite easily in machine code.

Needless to say there is a lot more to it than that. However everthing else
is really just a clothing of this basic rule.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Dec 16 '06 #8

P: n/a
Malcolm said:
>
<pr*********@gmail.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.com...
>>
Hi guys! I think all of u know about the designing of
compilers. Can any body tell me about the designing of the compilers.
And also tell me the difference between the compilers and Interpreter
which weresically used by the computers.
I want to know about the basic compiler software.

A commonsense, though not technical, difference is that a compiler turns
source code into machine code,
A slightly more technical view: a compiler turns source code from some
programming language into some other programming language. It need not be
machine code.

As a trivial example, AFAIK the following is a conforming C compiler (but
not a conforming implementation - for one thing, it doesn't come with all
the necessary documentation!):

#include <stdio.h>

int main(void)
{
int ch;
while((ch = getchar()) != EOF)
{
putchar(ch);
}
fputs("The code may contain a syntax error or constraint violation.\n",
stderr);
return 0;
}

And, of course, it turns C into C. :-)
whilst an interpreter runs a program that
calculates the program at run time.
Interpreters are much easier to write than compilers.
See above. :-)

<snip>

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 16 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.