BleepingComputer.com: HOW compiler works

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

HOW compiler works

#1 User is offline   ayush 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 19
  • Joined: 09-August 09

Posted 29 November 2010 - 08:01 PM

we all do prog. in a high level language such as c++, C#....each have their own compiler...but how do these compilers compile something written in ABCD to 0 & 1..... and in what these compilers are made? and if we go further in depth then do compilers also need compilers?

from compilers 1 more question arises... that if c is said to be mother language.... and other languages are based on it... then on what C is based...or ultimately which is the first high level language?

#2 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 29 November 2010 - 09:51 PM

Quote

or ultimately which is the first high level language?

That depends on how you define 'high level'. I would argue that since binary is the language of computers, then assembly would be the first higher level language.

Quote

that if c is said to be mother language

Says who?

Quote

but how do these compilers compile something written in ABCD to 0 & 1

Every single character can be represented by a series of binary numbers. the compiler reads in the code and then converts it. Basically.

Maybe you should start your research here:
http://en.wikipedia.org/wiki/Programming_language
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#3 User is offline   Minh Triet Pham Tran 

  • Member
  • PipPip
  • Find Topics
  • Group: Malware Study Hall Sophomore
  • Posts: 97
  • Joined: 07-January 12
  • Gender:Male

Posted 07 January 2012 - 05:12 PM

You should buy and read the Dragon book :) :
Amazon.com: Compilers: Principles, Techniques, and Tools (9780201100884): Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman: Books
http://www.amazon.com/Compilers-Principles-Techniques-Alfred-Aho/dp/0201100886

This post has been edited by Minh Triet Pham Tran: 07 January 2012 - 05:13 PM

If you think technology can solve your security problems, then you don't understand the problems and you don't understand the technology. — Bruce Schneier

#4 User is offline   A Future Pilot 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 46
  • Joined: 13-November 11

Posted 28 February 2012 - 10:59 PM

In short the compiler checks your system to see what type it is. It then converts the source code into the assembly language for your processor's architecture. That assembly code is then converted directly to binary and the computer reads it.

(Converting from high-level language to assembly isn't direct. It's more of a "If he wrote THIS, then we can do the same thing in assembly by using THIS THAT and THE OTHER. The conversion from assembly to binary, however, is directly 1-to-1, every command in assembly is converted to a particular binary number.)

#5 User is offline   NeverSayDie 

  • Distinguished Member
  • PipPipPipPipPip
  • Find Topics
  • Group: Malware Study Hall Sophomore
  • Posts: 801
  • Joined: 09-January 12
  • Gender:Male
  • Location:New Jersey

Posted 29 February 2012 - 02:14 AM

View Postayush, on 29 November 2010 - 08:01 PM, said:

we all do prog. in a high level language such as c++, C#....each have their own compiler...but how do these compilers compile something written in ABCD to 0 & 1..... and in what these compilers are made? and if we go further in depth then do compilers also need compilers?

from compilers 1 more question arises... that if c is said to be mother language.... and other languages are based on it... then on what C is based...or ultimately which is the first high level language?


The most incredible book to put it all in an easy to understand format is The Elements of Computing Systems ISBN 026214087X

It will make you a better programmer in a very natural way no matter what level you are at.

James

#6 User is offline   Didier Stevens 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: BC Advisor
  • Posts: 594
  • Joined: 12-October 10
  • Gender:Male

Posted 03 March 2012 - 12:24 PM

View Postayush, on 29 November 2010 - 08:01 PM, said:

from compilers 1 more question arises... that if c is said to be mother language.... and other languages are based on it... then on what C is based...or ultimately which is the first high level language?


C is not the mother language. C was developed in the early 70's, and is based on the B programming language.

Early programming languages like COBOL, FORTRAN and Lisp were developed in the late 50's.

BASIC was developed in the early 60's.
Didier Stevens
http://blog.DidierStevens.com
Microsoft MVP 2011-2012 Consumer Security
Posted Image

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users