Friday, June 5, 2020

What is a Compiler?

What's a compiler?


 The compiler translates the program into the target language in the source language of the program. The most well-known form of compiler is one that translates a high-level language like C into the native assembly language of the machine so that it can be executed. And of course, there are compilers for languages like C++, Java, C #, and Rust, and many more. The same techniques used in a traditional compiler are also used in any program which processes a language. For example, a typing program such as TEX translates a manuscript into a Postscript document. A graphic layout program like Dot consumes a list of nodes and edges and arranges them on a screen. The web browser translates an HTML document into an interactive graphic display. You need to understand and use the same techniques as traditional compilers to write programs like these. Compilers exist not only for translating programs, but also for improving them. The compiler helps the programmer to find errors in the program at compile-time, so that the user does not have to encounter them at runtime. Usually, more strict language results in more time-compile errors. This makes it harder for the programmer to work, but it makes it more likely that the program is correct. For example, the Ada language is infamous among programmers as challenging to write without compile-time errors, but once working, safety-critical systems such as the Boeing 777 aircraft are trusted. The compiler is separate from the interpreter, which reads the program and then executes it directly, without issuing a translation. This is also sometimes referred to as a virtual machine. Languages like Python and Ruby are typically performed by an interpreter who reads the source code directly. Compilers and interpreters are closely linked, and it is sometimes possible to exchange one for another. For example, Java compilers translate Java source code to Java byte code, which is the abstract form of the assembly language. Some Java Virtual Machine implementations work as interpreters, performing one instruction at a time. Others work by translating the byte code into the local machine code and then directly running the machine code. This is known as just in time compiling or JIT compiling.


No comments:

Post a Comment

Thanks

Climate Crisis and Innovation: Navigating Earth's Future

Climate Change: Recent Events and Technological Solutions 1. The Escalating Climate Crisis The climate crisis has intensified in recent year...