SlideShare una empresa de Scribd logo
1 de 15
What is code? - Part 1

 A simple tutorial on what it means
  to write code and compile/build

- by Nandeep Mali (http://miniorb.in)
  What is Code? by Nandeep Mali is licensed under a Creative Commons
   Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Code

A simple example:

main( ) { printf("hello, world"); }
Code is written in a 'language'

What is a programming language?




     English                Some programming language
Its called 'language' for a reason

English helps me talk to you.

A programming language helps me talk to a computer and give
it instructions on what I want to achieve.

Will not go into details of the binary code that computers can
understand, etc.
Huge number of languages

How does the computer
know so many
languages?

It doesnt.

It can only understand
binary.

What do we do when we
don't know a language?
We ask for a translator/dictionary

This is what we do in a computer.

When we write some code in a language, we need to translate
it to something that computers understands.

This process is called "building" the code.




Note: You must be wondering why don't we just write the language that computer understands directly?
This is because, a computer understands only binary. And its is very very very difficult to write binary
code. Since we humans are lazy, the hardworking scientists wrote higher level languages that facilitate
easier semantics that resemble English, just so us lazy programmers would have at least some time for
recreation.
Building the code

All new linux users wonder. What the heck is "building the
code"? And how does one do it?

Building the code essentially involves this:

1. Get the code you are planning to build (duh)
2. Translate the code into binary
3. Generate the executable that contains translated code that a
computer can understand
4. Have fun
Too high level?

Ok lets break this down.

Remember we said we need to translate code? The build process does exactly
that.

Let us say we write some code in C. Computer understands binary. We now
need to convert this. This is done by tools like:

GCC
Sounds familiar? Ever wondered why you need GCC? You remember Turbo C
from college days? GCC is exactly that. Its a 'compiler'. In a loose definition, it
helps convert our code into machine readable code.
More examples of compilers

These names may seem familiar:

GCC
Visual Studio
Turbo C

All of these are compiler tools made by hard working people so
we can write code in C and not break our heads with binary.
A note

Compilers are very complicated piece of software. For the
scope of this tutorial we will stick to basics. There are many
other processes involved like linking and interpretation for
scripting languages which we will not dive deep into. Needless
to say, we encourage you to explore these topics independently
anyway.
What compilers help us do?

They help translate code from one form to another. Hence we
can write code in easier higher level languages.

This also enables us to 'create' more languages. Python is
written in C. C is written in Assembly. Assembly is written in
Binary. Big circle eh?
What does the written code mean?

This is an important part of a tutorial.

We write code.
The compiler translates.

How does the compiler know what we wrote?

Analogy:
Writer writes a novel.
We don't understand the words
We refer to a dictionary.

Exactly the same.
Compiler haz a dictionary

All the code that you write uses some keywords and syntaxes.

All these keywords and syntaxes are defined for the compiler
by the hardworking people. That definition contains the
following:

"Listen carefully compiler-kun! If you find <name of syntax> in
the code, it means <meaning>."

So the compiler, very obediently, in a loose definition, just
replaces all the code with whatever is the definition. Just the
way we do when we are reading a story.
These dictionaries can be made by you
also on a higher level
The most basic syntaxes and functions are defined in the compiler's dictionary. We can now use these
basic building blocks to make more advanced dictionary.

When we define a 'function' in our code, the compiler references that definition to understand what it
means when I use it.

Example:

add(a, b) {
  return a + b;
}

main() {
  add(4, 5);
}

Here the compiler understands the symbols like + ; ( ) { } and words like return. It does not however know
what is add until you define it. That is why the first 3 lines define it. The compiler takes in every symbol
and word and tries to make a sign for it. If it doesn't find a definition it barfs and gives an error like:

"undefined reference to xxx"
Stay tuned for part two

Next we learn:

1. What do libraries mean? Why do you need them?
2. What does 'linking' mean?
3. What does an executable contain?
4. What is the difference between compiled and interpreted?

Más contenido relacionado

La actualidad más candente

Basic introduction to python
Basic introduction to pythonBasic introduction to python
Basic introduction to pythonpoonam bora
 
BIS07 Application Development - I
BIS07 Application Development - IBIS07 Application Development - I
BIS07 Application Development - IPrithwis Mukerjee
 
Computer languages
Computer languagesComputer languages
Computer languagesPrince Arsal
 
How keywords and reserved words differ?
How keywords and reserved words differ?How keywords and reserved words differ?
How keywords and reserved words differ?Ajay Chimmani
 
Programming paradigm and web programming
Programming paradigm and web programmingProgramming paradigm and web programming
Programming paradigm and web programmingMohammad Kamrul Hasan
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Ganesh Samarthyam
 
bounceHammerその後、導入事例、これから。
bounceHammerその後、導入事例、これから。bounceHammerその後、導入事例、これから。
bounceHammerその後、導入事例、これから。azumakuniyuki 🐈
 
Uri Nachmias - Adopting Swift @Houzz - The good, the bad and the ugly
Uri Nachmias - Adopting Swift @Houzz - The good, the bad and the uglyUri Nachmias - Adopting Swift @Houzz - The good, the bad and the ugly
Uri Nachmias - Adopting Swift @Houzz - The good, the bad and the uglytlv-ios-dev
 
Creating a compiler for your own language
Creating a compiler for your own languageCreating a compiler for your own language
Creating a compiler for your own languageAndrea Tino
 
8 programming concepts_you_should_know_in_2017
8 programming concepts_you_should_know_in_20178 programming concepts_you_should_know_in_2017
8 programming concepts_you_should_know_in_2017Rajesh Shirsagar
 
SDL Trados training course
SDL Trados training courseSDL Trados training course
SDL Trados training courseQabiria
 
PHP Syntax & Comments
PHP Syntax & CommentsPHP Syntax & Comments
PHP Syntax & CommentsSidrah Noor
 
3. Introduction to C language ||Learn C Programming Complete.
3. Introduction to C language ||Learn C Programming Complete.3. Introduction to C language ||Learn C Programming Complete.
3. Introduction to C language ||Learn C Programming Complete.Fiaz Hussain
 
Swift programming language
Swift programming languageSwift programming language
Swift programming languageNijo Job
 
C Programming- Harsh Sharma
C Programming- Harsh SharmaC Programming- Harsh Sharma
C Programming- Harsh SharmaHarsh Sharma
 

La actualidad más candente (20)

Basic introduction to python
Basic introduction to pythonBasic introduction to python
Basic introduction to python
 
BIS07 Application Development - I
BIS07 Application Development - IBIS07 Application Development - I
BIS07 Application Development - I
 
Computer languages
Computer languagesComputer languages
Computer languages
 
How keywords and reserved words differ?
How keywords and reserved words differ?How keywords and reserved words differ?
How keywords and reserved words differ?
 
Csharp_Chap01
Csharp_Chap01Csharp_Chap01
Csharp_Chap01
 
Learn C Language
Learn C LanguageLearn C Language
Learn C Language
 
Lect '1'
Lect '1'Lect '1'
Lect '1'
 
Programming paradigm and web programming
Programming paradigm and web programmingProgramming paradigm and web programming
Programming paradigm and web programming
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
bounceHammerその後、導入事例、これから。
bounceHammerその後、導入事例、これから。bounceHammerその後、導入事例、これから。
bounceHammerその後、導入事例、これから。
 
Uri Nachmias - Adopting Swift @Houzz - The good, the bad and the ugly
Uri Nachmias - Adopting Swift @Houzz - The good, the bad and the uglyUri Nachmias - Adopting Swift @Houzz - The good, the bad and the ugly
Uri Nachmias - Adopting Swift @Houzz - The good, the bad and the ugly
 
Creating a compiler for your own language
Creating a compiler for your own languageCreating a compiler for your own language
Creating a compiler for your own language
 
Cs101
Cs101Cs101
Cs101
 
8 programming concepts_you_should_know_in_2017
8 programming concepts_you_should_know_in_20178 programming concepts_you_should_know_in_2017
8 programming concepts_you_should_know_in_2017
 
SDL Trados training course
SDL Trados training courseSDL Trados training course
SDL Trados training course
 
PHP Syntax & Comments
PHP Syntax & CommentsPHP Syntax & Comments
PHP Syntax & Comments
 
10 lesson6
10 lesson610 lesson6
10 lesson6
 
3. Introduction to C language ||Learn C Programming Complete.
3. Introduction to C language ||Learn C Programming Complete.3. Introduction to C language ||Learn C Programming Complete.
3. Introduction to C language ||Learn C Programming Complete.
 
Swift programming language
Swift programming languageSwift programming language
Swift programming language
 
C Programming- Harsh Sharma
C Programming- Harsh SharmaC Programming- Harsh Sharma
C Programming- Harsh Sharma
 

Similar a What is code? - Part 1 explained in simple terms

Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Md Hossen
 
Computer programming tools and building process
Computer programming tools and building processComputer programming tools and building process
Computer programming tools and building processArghodeepPaul
 
notes on Programming fundamentals
notes on Programming fundamentals notes on Programming fundamentals
notes on Programming fundamentals ArghodeepPaul
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and developmentAli Raza
 
What Is Coding And Why Should You Learn It?
What Is Coding And Why Should You Learn It?What Is Coding And Why Should You Learn It?
What Is Coding And Why Should You Learn It?Syed Hassan Raza
 
Comso c++
Comso c++Comso c++
Comso c++Mi L
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it securityCESAR A. RUIZ C
 
Demystifying dot NET reverse engineering - Part1
Demystifying  dot NET reverse engineering - Part1Demystifying  dot NET reverse engineering - Part1
Demystifying dot NET reverse engineering - Part1Soufiane Tahiri
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01Getachew Ganfur
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfSubramanyambharathis
 
Compiler design slide share
Compiler design slide shareCompiler design slide share
Compiler design slide shareSudhaa Ravi
 
Compliers and interpreters
Compliers and interpretersCompliers and interpreters
Compliers and interpretersshivasdhtsvmic
 

Similar a What is code? - Part 1 explained in simple terms (20)

Unit 1
Unit 1Unit 1
Unit 1
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
 
Computer programming tools and building process
Computer programming tools and building processComputer programming tools and building process
Computer programming tools and building process
 
notes on Programming fundamentals
notes on Programming fundamentals notes on Programming fundamentals
notes on Programming fundamentals
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
 
What Is Coding And Why Should You Learn It?
What Is Coding And Why Should You Learn It?What Is Coding And Why Should You Learn It?
What Is Coding And Why Should You Learn It?
 
Programming in C++
Programming in C++Programming in C++
Programming in C++
 
Comso c++
Comso c++Comso c++
Comso c++
 
Lecture 1-3.ppt
Lecture 1-3.pptLecture 1-3.ppt
Lecture 1-3.ppt
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it security
 
Demystifying dot NET reverse engineering - Part1
Demystifying  dot NET reverse engineering - Part1Demystifying  dot NET reverse engineering - Part1
Demystifying dot NET reverse engineering - Part1
 
C++ for hackers
C++ for hackersC++ for hackers
C++ for hackers
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01
 
INTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptxINTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptx
 
C lecture notes new
C lecture notes newC lecture notes new
C lecture notes new
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
 
Compiler design slide share
Compiler design slide shareCompiler design slide share
Compiler design slide share
 
Compliers and interpreters
Compliers and interpretersCompliers and interpreters
Compliers and interpreters
 
Assembler
AssemblerAssembler
Assembler
 
Code learning
Code learningCode learning
Code learning
 

Último

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 

Último (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 

What is code? - Part 1 explained in simple terms

  • 1. What is code? - Part 1 A simple tutorial on what it means to write code and compile/build - by Nandeep Mali (http://miniorb.in) What is Code? by Nandeep Mali is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
  • 2. Code A simple example: main( ) { printf("hello, world"); }
  • 3. Code is written in a 'language' What is a programming language? English Some programming language
  • 4. Its called 'language' for a reason English helps me talk to you. A programming language helps me talk to a computer and give it instructions on what I want to achieve. Will not go into details of the binary code that computers can understand, etc.
  • 5. Huge number of languages How does the computer know so many languages? It doesnt. It can only understand binary. What do we do when we don't know a language?
  • 6. We ask for a translator/dictionary This is what we do in a computer. When we write some code in a language, we need to translate it to something that computers understands. This process is called "building" the code. Note: You must be wondering why don't we just write the language that computer understands directly? This is because, a computer understands only binary. And its is very very very difficult to write binary code. Since we humans are lazy, the hardworking scientists wrote higher level languages that facilitate easier semantics that resemble English, just so us lazy programmers would have at least some time for recreation.
  • 7. Building the code All new linux users wonder. What the heck is "building the code"? And how does one do it? Building the code essentially involves this: 1. Get the code you are planning to build (duh) 2. Translate the code into binary 3. Generate the executable that contains translated code that a computer can understand 4. Have fun
  • 8. Too high level? Ok lets break this down. Remember we said we need to translate code? The build process does exactly that. Let us say we write some code in C. Computer understands binary. We now need to convert this. This is done by tools like: GCC Sounds familiar? Ever wondered why you need GCC? You remember Turbo C from college days? GCC is exactly that. Its a 'compiler'. In a loose definition, it helps convert our code into machine readable code.
  • 9. More examples of compilers These names may seem familiar: GCC Visual Studio Turbo C All of these are compiler tools made by hard working people so we can write code in C and not break our heads with binary.
  • 10. A note Compilers are very complicated piece of software. For the scope of this tutorial we will stick to basics. There are many other processes involved like linking and interpretation for scripting languages which we will not dive deep into. Needless to say, we encourage you to explore these topics independently anyway.
  • 11. What compilers help us do? They help translate code from one form to another. Hence we can write code in easier higher level languages. This also enables us to 'create' more languages. Python is written in C. C is written in Assembly. Assembly is written in Binary. Big circle eh?
  • 12. What does the written code mean? This is an important part of a tutorial. We write code. The compiler translates. How does the compiler know what we wrote? Analogy: Writer writes a novel. We don't understand the words We refer to a dictionary. Exactly the same.
  • 13. Compiler haz a dictionary All the code that you write uses some keywords and syntaxes. All these keywords and syntaxes are defined for the compiler by the hardworking people. That definition contains the following: "Listen carefully compiler-kun! If you find <name of syntax> in the code, it means <meaning>." So the compiler, very obediently, in a loose definition, just replaces all the code with whatever is the definition. Just the way we do when we are reading a story.
  • 14. These dictionaries can be made by you also on a higher level The most basic syntaxes and functions are defined in the compiler's dictionary. We can now use these basic building blocks to make more advanced dictionary. When we define a 'function' in our code, the compiler references that definition to understand what it means when I use it. Example: add(a, b) { return a + b; } main() { add(4, 5); } Here the compiler understands the symbols like + ; ( ) { } and words like return. It does not however know what is add until you define it. That is why the first 3 lines define it. The compiler takes in every symbol and word and tries to make a sign for it. If it doesn't find a definition it barfs and gives an error like: "undefined reference to xxx"
  • 15. Stay tuned for part two Next we learn: 1. What do libraries mean? Why do you need them? 2. What does 'linking' mean? 3. What does an executable contain? 4. What is the difference between compiled and interpreted?