A code is converted source code written in a high-level programming language to machine code(such as Java) into machine code for a specific computer architecture (such as the Intel Pentium architecture). The generated machine code can then be run several times with different data each time.
A compiler is a software program that converts pre-programmed code into a more simple machine language that is similar to the hardware’s “bare metal” and more readable by the computer.
Features of compilers
- Maintaining the right interpretation of the code
- The speed of the target code
- Understand prototypes for legal and illegal systems
- Good documentation / management of errors
- Speed of compilation
- Code debugging help
Task of compilers
Tasks which are performed by compilers :
- Divides the source programme into parts and imposes on them a grammatical structure.
- Makes it possible to create the desired from the intermediate representation.
- target programme and also create the symbol table.
- Compiles and detects source code errors.
- Storage of all variables and codes is handled.
- Different compilations are supported.
- Learn, interpret, and translate the entire programme to a semantically equivalent.
- Depending on the computer sort, conversion of the source code into object code.
Phase of compilers
The method of compilation includes the sequence of different stages. Each phase takes a source programme in one representation and produces output in another representation. From its previous stage, each process takes input.
The various stages of the compiler take place :
- Lexical Analysis
- Syntax Analysis
- Semantic Analysis
- Intermediate Code Generation
- Code Optimisation
- Code Generation
Interested in learning about similar topics? Here are a few hand-picked blogs for you!