Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

lifecycle
program
compiler

Definition: Compiler

Educative Answers Team

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 ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring