COMPILER is used to?
convert high level into low level language
A compiler is a crucial tool in computer programming. Its primary job is to translate source code written in a high-level programming language (like C++, Java, Python) into a low-level language that the computer's processor can understand and execute, typically machine code or an intermediate code.
The compiler takes the entire source code written in a high-level language and goes through several stages:
The output of the compiler is an executable file that the computer can run directly.
Let's look at why the other options are less accurate:
Therefore, the primary role of a compiler is to convert high-level language into low-level language, making the code executable by the computer.
| Grammar (G1) | Semantic Rules |
|---|---|
| $D \rightarrow T\ V$ | $D.type = T.type$ $V.type = T.type$ |
| $T \rightarrow int$ | $T.type = int$ |
| $T \rightarrow float$ | $T.type = float$ |
| $V \rightarrow V_1\ id$ | $V_1.type = V.type$ $put(id.entry, V.type)$ |
| $V \rightarrow id$ | $put(id.entry, V.type)$ |
| Grammar (G2) | Semantic Rules |
|---|---|
| $D \rightarrow D_1\ id$ | $D.type = D_1.type$ $put(id.entry, D_1.type)$ |
| $D \rightarrow T\ id$ | $D.type = T.type$ $put(id.entry, T.type)$ |
| $T \rightarrow int$ | $T.type = int$ |
| $T \rightarrow float$ | $T.type = float$ |
Which of the following statement(s) are correct?
A. Syntax Directed Translation can be applied in Type Checking.
B. Syntax Directed Translation can be used in 3-address code generation.
C. Syntax Directed Translation can be used in construction of syntax tree.
D. Syntax Directed Translation can be used to recognize valid tokens.
Choose the most appropriate answer from the options given below:
Which of the following tasks could be attained using syntax trees in compiler design ?
(A) Type Checking
(B) Code Generation
(C) Code Optimization
(D) Error Handling
Choose the correct answer from the options given below :