Skip to main content

How Compiler Works

compiler-working-principle

What is a Compiler? In Computer, the compiler is defined as the computer program that easily converts source code of source language into another required computer language. The conversion of the source language is possible with the help of the compiler.

The various elements of Compiler are source code, lexical analyzer, tokenized code, syntactic analyzer, parsed code, semantic analyzer, qualified code, code generator, object code, optimizer, final code, etc.

There are generally five stages of a compiler to convert any source language into another low level desired language.

In the first stage, the lexical analyzer plays an important role in the conversion. Here, the source code is analyzed by the lexical analyzer to convert it into the tokenized code. The main function of lexical analyzer is to generate or create tokens. In this stage, the source code is formatted for easy access to get required tokens.

In the second stage, the syntactic analyzer plays an important role in further conversion. Here, the tokenized code is converted into parsed code. The main function of the syntactic analyzer is to analyze the tokenized codes for structure and further processing.

In the third stage, the semantic analyzer plays an important role to convert the parsed code into the qualified code. Also, the main function of the semantic analyzer is to analyze the parsed code for meaning.

In the fourth stage, the qualified code is linearized with the help of code generator to produce or generate object code. The main function of the code generator is to create equivalent object codes for further processing of codes.

In the intermediate code generator, the compiler converts some of the intermediate representation of available source code into a machine code that can be easily read and executed by the machine or computer.

In fifth or last stage, the optimizer plays an important role to create required final code. Here, the optimizer analyzes the object code produced by the code generator into the final code.

Code Optimization In Computer Program 

What is code optimization? Why code optimization is needed? Why it is important? It is mainly used for the purpose of code modification. The code optimization modifies variously available codes to improve code quality and efficiency so that there should be very less error.

The code optimization is also used to convert large size codes into the smaller one. Due to code size conversion, the particular code consumes less memory compared to other untouched codes. The largely sized codes consume larger space memory. Due to code optimization, certain space or block of memory is saved or consumed. Also, the optimized code performs just a few inputs and output operations as compared to the non-optimized codes. Another important property of optimized code is that it executes more faster and rapidly.

Interpreter In Computer Program: 
It directly executes as compared to the compiler. It is quite different than compiler in the context of instructions written because, in the interpreter, the instructions are written directly in the scripting language.

Popular posts from this blog

Strategic Management - Importance of Internal Factor Analysis

Importance of Internal Factor Analysis 1. Internal factor analysis helps to analyze its resources and functional strengths and weaknesses. 2. Internal factor analysis helps to understand the factors and work upon those factors so as to gain competitive advantage, growth, and profitability in the firm. 3. Internal factor analysis helps to internally assess the organization and formulate, implement, and evaluate the strategic plan and cross-functional decision so as to achieve the company's primary objective of above-average return and competitive advantage. 4. Internal factor analysis explains the company's available resources or ease of access to resources and whether those resources are rare, easily, or hardly imitable, and whether substitute available or not. Resources are defined by their type, nature, and amount. Internal factors analysis helps to understand the organization internally and with a clear understanding of its competencies and capabilities that

Importance of Modulation in Communication System

There is a huge importance of modulation in the communication system . It is defined as the modification process of the message signals in the communication system. In the modulation process, the message signal of very low frequencies is impressed. And, only the carrier signal of high frequency is passed through the transmission process. It is one of the important techniques in which the addition of a signal is done to an optical signal carrier or electronic wave carrier. It is very important as it uses the properties of a periodic waveform the most. It is used in communication just to pass the signal which bears information from one source to another destination. Here, a transmitter is used which is normally present to modify the message signal. In this process, the message signal is modified in a suitable form and it is transmitted over various communication channels. This whole process of modification of message and carrier signals is termed as modulation. The need for

Importance of External Environmental Analysis in Strategic Management

External Environmental Analysis (EEA) is the analysis of the external environment which helps in analyzing the trends and activities of the industry in the marketplace. The processes of EEA are: 1. Scanning 2. Monitoring 3. Forecasting 4. Accessing Micro and Macro factors in the Business Micro factors look at the specificity and macro factors look at the overall economy/business. Micro factors can be influenced because it is an assessment of the specific firm, and Macro factors are less influenced because it is external factors that are difficult to predict and understand. Therefore, micro factors are the factors of the specific firm such as the functional department, policies, procedures, laws, and others which can be influenced and changed when necessary. But, macro factors are external factors/segments such as demographics, political, legal, socio-cultural, technology, environment, and legal issues that can be difficult to predict and influence. External Environmental An

Top 5 Advantages of Digital Communication System

Good Reasons To Choose Digital Communication System 1. The digital communication system has high noise immunity. High noise immunity means the digital communication system is more immune to noise as compared to the analog communication system. In an analog communication system, the system has less noise immunity compared to a digital system. The noise produced in an analog communication system is very high compared to the digital communication system. Therefore, the digital communication system is preferred for better noise immunity. 2. It has many advantages in storing and processing various data and information. The data and information stored or retrieved in a digital communication system can be achieved in any format like audio or video, etc. But in an analog communication system, the information processed is hard to obtain in any desirable format. It can't achieve in the format demanded by the user. Therefore, the digital communication system is preferred for a bet

Study of Evolution And Classification of Computers

Evolution of Computer Technology The computers were evolved in various time periods and the various factors or fundamental technology were responsible for the evolution of computers as per human needs. How are computers classified? The classifications of computers are based on fundamental technology like speed, memory, storage capacity, size, etc. These factors (fundamental technology) were the reason behind the evolution of computers. Each new generation is characterized by various important factors like a smaller size, greater speed, larger memory, huge data storage capacity and more. History about the evolution of computers: They are classified into five generations. They are named as first generation computers, second-generation computers, third generation computers, fourth generation computers, and fifth generation computers. The computers evolved in the various generation has its own significance value. They were very precious and important at that time period. All

The Opportunities and Threats of Globalization in International business

Globalization provides opportunities to international business operators are as follows: Political Liberalization  The political ideology of any nation removes the barrier to conducting trade activities. There is a friendly environment for the investors to conduct the business which is the major reason for the opportunity for globalization. Technology The technology is innovated and novelties are found every day. It is creating the opportunity to globalize as the innovation has made able to operate the business in any corner of the world. Cost  The opportunity of globalization is the cost factor. To gain economies of scale i.e. efficiency in labor, the businesses are operating all around the world. Market  The need for expansion of the market to operate competitively is another opportunity to globalize the business. Competition  The competitive intensity is raising due to which business investors are more influenced to operate globally to grab the opportunity. Howev

External Environment Analysis (PESTLE, Porter’s 5 forces, Opportunities, and Threats) of the Nepal Airlines Corporation

Nepal Airlines is the national flag carrier of Nepal, established in 1958 and headquartered in Kathmandu, Nepal.  External Environment Analysis - PESTLE Analysis  Political:   The airline industry is widely obstructed by regulations and restrictions so the government-owned Nepal Airlines has been suffering due to poor management, high political interference, and corruption.    Economic: According to the forecast of economic models, the Nepal GDP per capita (PPP) was projected to trend around 2690.00 USD in 2020, and also the economic condition of the Nepalese citizens is improving. This signifies that air travelers are increasing significantly and the aviation industry will ultimately keep on growing.  Social:   The Nepalese youths are migrating to India/Malaysia and mostly gulf countries to earn money due to the unemployment condition in Nepal. Also, many Nepalese students are going abroad for higher studies to gain quality education from foreign institutions. Also, Nepal

Importance of Switching System in Telecommunication

There is an important role of the switching system in the field of telecommunication. Switching System is defined as the system which is generally used to establish a connection between entities and outlets. The other important function of the switching system is to establish and release the call made by the user. The switching system is mainly divided into two major headings. They are termed as manual switching system and the automatic switching system. And, the automatic switching system is also classified into two parts. They are known as electromechanical switching system and the electronic switching system. The electromechanical switching system is further divided into step-by-step switching system and the crossbar switching system. Also, the electronic switching system is further divided into space division and time division switching system. The time division switching system is also classified under two headings. They are digital and analog time division switching sy

Importance of Instrumentation Amplifier Having A Linear feedback

Instrumentation Amplifier Design and Analysis It is best to choose the Instrumentation amplifier. There are various differences between the instrumentation amplifier and isolation amplifier. An instrumentation amplifier is similar to an operational amplifier which is a closed loop device having a linear feedback. It is very important in electronic circuits as it has the constant gain factor. The gain error in the instrumentation amplifier is zero which is very useful. The input impedance of the instrumentation amplifier is infinite. It has zero noise level and offset dc is also zero. The output impedance of the instrumentation amplifier is also zero which is also the important characteristics of the instrumentation amplifier. In practical consideration in electronic circuits, the output impedance, offset dc and noise level is very low. Similarly, the input impedance of the instrumentation amplifier in practical consideration is very high. Also, the gain accuracy in this a

The Business Idea of Online Card Design

Business Development Plan of Online Card Design (BDP Sample) Do you know online card design has been one of the most neglected industries in the country? The new business is emerging day by day, and many cultural programs are held in many places in our city. The trend of business card exchanging is increasing a lot lately. There are some card designers as well as card printers. As we have diversity in the culture we have many cultures locally. And there are many e-commerce sites in the country. But, there is no site that provides a card design facility and delivery to the end customer. The customers can choose from millions of templates that are designed by the local designer who is an expert in their field. This will be an opportunity for the designer who will design the templates and the end customer who will enjoy the design made by them. It’s a stop for both the parties which can be very profitable Online card design, the idea is old but there is no current market competitor