✅ Define what a programming language is and its purpose.
✅ Differentiate between low-level and high-level programming languages.
✅ Understand the role of a compiler and an interpreter in executing code.
What is a Programming Language?
A programming language is a formal language with a set of instructions used to create software programs and implement algorithms.
Think of it as a special vocabulary and set of grammar rules to communicate with a computer.
Analogy: A programming language is like a recipe. The ingredients and steps (the code) must be written in a language the chef (the computer) understands to produce a final dish (the output).
Activity: The Recipe Analogy
Match each recipe component to its programming equivalent. Select from the dropdown and press Check.
Recipe Component
Your Answer
The recipe book — the rules and vocabulary
The written recipe — your specific instructions
The chef — who reads and executes the recipe
The final dish — what comes out at the end
The Language Spectrum
Programming languages exist on a spectrum, from the computer's native tongue to languages that resemble human speech.
Low-Level
Closer to Hardware ⚙️
Less abstraction
Faster, but harder to use
High-Level
Closer to Human 🧑💻
More abstraction
Slower, but easier to use
Activity: Sort the Languages
Click each item to place it in the correct category. Is it Low-Level or High-Level?
These languages provide little to no abstraction from a computer's hardware and are very close to machine code.
Machine Language
The "native" language of the CPU.
Consists of binary code (0s and 1s).
Not human-readable.
01001000 01100101 01101100 01101100 01101111
(This is "Hello" in binary)
Assembly Language
A step above machine code.
Uses mnemonics (short words) like MOV, ADD.
Requires an assembler to convert to machine code.
MOV AL, 61h
(Move the value 61 (hex) into register AL)
Activity: Binary Letter Explorer
Every character stored by a computer is encoded as 8-bit binary. Click a letter to see its binary representation.
?→decimal ?→
00000000
🚀 High-Level Languages
Designed to be easy for humans to read, write, and maintain, with strong abstraction from hardware details.
Characteristics
English-like syntax
Easier to learn and debug
Portable across different computer systems
Focus on logic, not hardware management
Popular Examples
🐍 Python
☕ Java
🌐 JavaScript
#️⃣ C#
++ C++
The Translation Problem
Computers only understand machine code, but we write in high-level languages. How do we bridge this gap?
🧑💻 High-Level Code➡️❓➡️⚙️ Machine Code
High-level source code must be translated into low-level machine code before the CPU can execute it.
Compilers vs. Interpreters 📊
The translation is handled by two types of programs: Compilers and Interpreters.
Compiler
Translates the entire program at once.
Creates a separate executable file (e.g., .exe).
Execution is generally faster.
Errors are reported after the whole program is checked.
Examples: C, C++, Java
Interpreter
Translates the program line by line.
No separate executable file is created.
Execution is generally slower.
Errors are reported as soon as they are found.
Examples: Python, JavaScript, Ruby
How a Compiler Works ⚙️
Source Code
my_program.cpp
➡️
Compiler
Translates all at once
➡️
Executable File
my_program.exe
Key Idea: Compile once, run anytime. The translation and execution are two separate steps.
How an Interpreter Works ⚡
Source Code
my_script.py
➡️
Interpreter
Translates & Executes Line by Line
➡️
Immediate Output
Program runs directly
Key Idea: Translation and execution happen at the same time, every time you run the script.
Application in Nepal 🇳🇵
The choice of language impacts many local tech solutions.
Which language for which job?
Building a Digital Wallet (e.g., eSewa, Khalti): Performance and security are critical. Compiled languages like Java or Kotlin (for Android) are a strong choice.
Developing a News Portal (e.g., OnlineKhabar): Rapid updates and content management are key. Interpreted languages like PHP or JavaScript (with frameworks) allow for fast development cycles.
Data Analysis for Trekking Tourism: Scripting and quick analysis are needed. Python is ideal due to its powerful data science libraries and ease of use.
Key Takeaways
Programming languages are the tools we use to give instructions to computers, ranging from low-level to high-level.
Low-level languages (Machine, Assembly) are close to the hardware, offering speed but complexity.
High-level languages (Python, Java) are close to human language, offering simplicity and portability.
Compilers translate an entire program at once into an executable file.
Interpreters translate and execute a program line by line, at the same time.