Trusted answers to developer questions

Definition: Compiler

Get Started With Machine Learning

Learn the fundamentals of Machine Learning with this free course. Future-proof your career by adding ML skills to your toolkit — or prepare to land a job in AI or Data Science.

A computer can only execute instructions written in machine code (a sequence of zeros and ones). However, writing a program in machine code is a tedious process; therefore, programmers often write code in high-level programming languages like C++. The code that the programmer writes goes to a program called the compiler that converts it into machine code.

svg viewer

Important steps

The following are some tasks that a compiler performs before converting source code to machine code:

svg viewer

Tokenizing

A compiler goes over the entire code and groups the characters into strings called tokens. Common token names include operator and identifier.

Parsing

A compiler checks for syntax error, i.e., if the tokens appear in incorrect order in the code.

Semantic analysis

Semantic analysis includes checking if variable usage is consistent with the rules of the programming language.

RELATED TAGS

lifecycle
program
compiler
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?