Skip to main content
Tweeted twitter.com/#!/StackCompSci/status/266719007883812864
edited tags
Link
Raphael
  • 72.9k
  • 30
  • 181
  • 393
Title changed
Link
Shashwat
  • 503
  • 2
  • 5
  • 14

Some doubtsquestions regarding compilers and assemblers

Source Link
Shashwat
  • 503
  • 2
  • 5
  • 14

Some doubts regarding compilers and assemblers

Lots of basic questions are there in my mind. I need to clear them.

Statement 1: A compiler converts a human-readable codes to object codes, and those are converted to a machine code (executable) by linker.

Am I right here?

At wikipedia, it is written that

Object files are produced by an assembler, compiler, or other language
translator, and used as input to the linker.

Question 1: An assembler converts assembly language code (MOV A, B ADD C) to machine code. In case of high-level language like C++, that is generated by linker above. So assembler is not used anywhere. So how can it create an object file as written above?

Intermediate code is generated to make the code run on different architectures.

Question 2: Are *.class (bytecode) files created by java compiler object files? If yes, then can we say that the JVM that runs them is a type of linker (however its not creating the executable)?

Question 3: When we compile a C++ program in Turbo C++, we get *.obj files which are the object files. Can we use them to generate the executable in some other architecture?