Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What's the difference between a compiler and a compiler?


Asked by Lilly Blackwell on Dec 01, 2021 FAQ



The difference lies in the way they read the source code or input. A compiler reads the whole source code at once, creates tokens, checks semantics, generates intermediate code, executes the whole program and may involve many passes.
In respect to this,
ROLE OF COMPILER. A part of the compiler’s job is to analyze the program code for “correctness”. If the meaning of a program is correct, then a compiler can not detect errors ( e.g., if different statements are used etc.), but a compiler can certainly detect errors in the form of a program.
Thereof, In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language).
Subsequently,
Compiler cares about the meaning of the tokens, while preprocessor only cares about their lexical form. For example, compiler distinguishes between identifiers and keywords, while preprocessor treats them all as identifiers; compiler distinguishes between operators and punctuators, while preprocessor groups them together.
Similarly,
A compiler is a program that translates human-readable source code into computer-executable machine code. To do this successfully, the human-readable code must comply with the syntax rules of whichever programming language it is written in. The compiler is only a program and cannot fix your code for you.