Points before Studying Compiler Design

In this video, we discuss Points before Studying Compiler Design.

Watch our complete playlist, How to study computer science, for guidance. Click Here.

In our previous videos, We discussed that one must study computer science subjects for a better understanding of computer science.

Compiler design is one of those basic subjects.

Before starting compiler design, one should have the Theory of computation basics. Click Here to study TOC.

Below we discuss a brief understanding of the role of compiler design.

Remember the points discussed and start studying compiler design. Click Here to study compiler design.

Role of Compiler:

To convert high-level language to machine-level language.

The below diagram shows an example of a high-level language.

Points before Studying Compiler Design1.1

With the example, we understand the sessions present in our subject and how it’s related to TOC.

‘a+b’ is converted to add instruction in our computer organization and architecture course.

z = c+a is converted to add and store instructions in COA.

How are these high-level statements converted?

1st Session

The first step in conversion is to read the program character by character and identity tokens.

The above diagram shows the tokens examples.

Identify tokens, identifiers, and keywords.

We use Finite automata to identify the tokens.

We provide the programmatic intuition of finite automata in TOC.

The finite automata concept helps you understand the first Session in compiler design.

2nd Session:

Once we have identified the tokens, the second step is to identify the syntax of each line.

Each line is syntactically correct or not identified.

To evaluate the syntax. We use Context-free grammar from the Theory of computation.

In the Theory of computation, we discussed the programmatic intuition of context-free grammar.

Using recursive functions, we implement context-free grammar.

3rd Session:

We do Programming language condition checks and conversion to machine-level instructions.

From the above example, z is a variable that is not declared.

In C language, Variables must be declared before using them.

The above condition is an example of a programming language conditional check.

Each programming language has its conditions.

Using context-free grammar, we check the conditions and convert them to machine-level language.

4th Session:

Optimization of machine-level instructions.

Optimizing the machine-level instructions based on the processor architecture is discussed.