answersLogoWhite

0


Best Answer

They don't. All compilers produce machine code by default, with the exception of the Java compiler which emits Java byte code suitable for interpretation by the Java virtual machine at runtime.

What you call assembly is actually the disassembled machine code. That is, the machine code produced by the compiler is translated into the equivalent disassembly. This is the code you see when you hit a breakpoint and examine the disassembled machine code. You will also see disassembly when debugging code for which no source code exists (as is the case with most 3rd party libraries).

If you wish to view the actual assembly, along with your comments and source code, then you have to configure your compiler to emit assembly rather than the default machine code. You would do this if you wished to tweak the assembled code prior to final assembly, for instance, to take advantage of manual optimisations. However, modern compilers are capable of optimising code more efficiently and more easily than any human can so there's rarely a need to manually optimise.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why do most compilers do not directly produce machine languages but rather they produce assembly languages instead?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is programming launguage?

A programming language is a language to communicate with the machine (computer). It can either high or low level programming language. A high level programming language is harder to understand by computers but easier by people. These include BASIC, C++, Java and etc. Low level programming languages are understandable by computers and people , like assembly and other system programing languages. Compilers/Linkers/Interpreters are needed to translate between programming language into machine language (binary code - 010001001 etc). If you want to learn programming language, first you should learn Basic or Python then goto C++ or Java. You can also learn C instead of C+++, your choice.


Short note on high level language?

Generally languages are used for communication, In the case of computers languages are used to communicate with the Hardware. Language consist of set of rules and syntaxes to frame the valid instructions to work with the Machines.


Was the assembly line a good invention?

The good think about the assembly line is it was faster than two humans and instead of waiting for a long time with the assembly line you won't have to wait twice as longer than humans


Which computer language uses mnemonics to write computer programs?

In a sense they all do, but you are probably thinking of Assembly languages (where the term "mnemonic" is used explicitly for the identifiers used to stand for instruction opcodes, register numbers, etc.Note: there is no single Assembly language, every modern computer architecture has at least one Assembly language specific to its unique instruction set.


Why is assembly language called a low level language?

x86 assembly language is crucial to be able to do any serious security or reverse engineering work. In addition, it allows one to write well optimized code. It also gives the opportunity to understand how things really work inside the computer, which is by itself very important if you want to become a competent programmer. x86 assembly language is not very hard to learn. In fact, if you know basic math (The one that you learn in elementary school), you could learn it yourself. I recorded an online video course for x86 assembly (paid) and exercises (Open source). You can find it at the address xorpd dot net. This course will teach you x86 assuming that you know nothing. It only assumes that you know how to add numbers. (In base 10). In the end of the course you will be able to write fully working x86 assembly programs on the Fasm assembler over the Windows operation system. xorpd.

Related questions

Is dotnet a framework or a language?

A framework. It uses an intermediate language(called MSIL) similar to java byte code. You compiler for whatever language you like compiles to MSIL instead of x86 assembly. C#,C++, and Visual Basic are the languages typically used but there are other .NET compilers for python, ruby, etc. It is a framework and it's suports multiple languages


What is an assembly of citizens instead of a king?

aristocracy


How is Compiler Different from Interpretor?

A traditional compiler converts the source code to machine code; many recent compilers convert the source code to some intermediate language instead. An interpreter runs the source code directly, which means the source code is basically "interpreted" one line at a time.


What country was ruled by an assembly of citizens instead of a king?

Aristocracy


What is a country ruled by an assembly of citizens instead of a king?

Aristocracy


A country ruled by an assembly of citizens instead of a king?

An Aristocracy


What is programming launguage?

A programming language is a language to communicate with the machine (computer). It can either high or low level programming language. A high level programming language is harder to understand by computers but easier by people. These include BASIC, C++, Java and etc. Low level programming languages are understandable by computers and people , like assembly and other system programing languages. Compilers/Linkers/Interpreters are needed to translate between programming language into machine language (binary code - 010001001 etc). If you want to learn programming language, first you should learn Basic or Python then goto C++ or Java. You can also learn C instead of C+++, your choice.


How can embedded the assembly language in c?

Compiler-dependent, in real life you should never do that, write separated Assembly modules instead.


Motivation for developing and using low level languages?

By low level languages I'm assuming you mean assembly. There are two main reasons to program in assembly. One is performance critical applications, things like device drivers. When drawing graphics for example, it's important to do it as fast as possible. Good assembly programmers can squeeze just a little more out of a computer, and sometimes it makes all the difference. The other reason may be harder to spot. You may not recognize all of the computers in your daily life, like a noise making toy. There's a computer in there, however tiny, and it has to be programmed. Assembly language can be made more compact than compiled languages, and if you can fit your code into a $0.20 chip instead of a $0.30 chip; over millions of toys, that's a substantial savings. While compiled languages are much easier and faster to program in, assembly still has its place.


What is the difference between assembler and compiler?

Assembler- A computer program that takes computer instructions and converts them into a pattern of bits that the computer can understand and perform by it certain operations. Compiler- program that processes statements written in a programming language and turns them into machine language that a computer's processor uses. this program get the syntax error in the written program Conceptually speaking, both an assembler and a compiler do exactly the same thing: they take as input some language that is human-understandable, and translate that directly into machine code instructions that the computer can execute. However, in common usage, an "assembler" refers specifically to a such a program that takes as its input assembly language. Assembly language is a very "low-level" programming language, where short acronyms as used to represent machine instructions. Thus, assembly language very, very closely mirrors the actual machine code being executed, and (realistically) is only very mildly "human readable". Assemblers do little more than directly translate the assembly source code into machine code - that is, they don't do optimization of their own, as assembly language is meant as a direct representation of the machine code, and thus no optimization is required (or, desired). A "compiler" generally refers to any other instance of this concept, but usually means something that take a "higher-level language" (i.e. anything above assembly language) and translates that to machine code. Compilers generally need to be significantly "smarter" than an assembler, as the compiler does a whole lot more work, and thus, has the opportunity to make significantly optimizations when doing the source->machine code translation. That is, high-level languages allow for the expression of concepts of ideas, which make them ideal for humans to write programs in. The compiler must be sophisticated enough to take these ideas and convert them into concrete machine code instructions. In addition, better compilers notice places where shortcuts can be taken (optimizations) given the overall structure of the input source code.


Why java's code first converted into byte code instead of directly converted into machine code?

Because that's how java works. There are many other languages (C, for example), that work with direct compilation, and others (like PHP) that are interpreted.


Short note on high level language?

Generally languages are used for communication, In the case of computers languages are used to communicate with the Hardware. Language consist of set of rules and syntaxes to frame the valid instructions to work with the Machines.