Chapterبەش 1 · Lectureوانە 1.3
How Code Becomes a Running Program: Compilers and Interpretersچۆن کۆد دەبێت بە بەرنامەیەک کە کار دەکات: کۆمپایلەرەکان و ئینتەرپرێتەرەکان
Why source code must be translated; how a compiler and an interpreter work, what each is good at, and what happens to a mistake on line 4; and the modern mix used by Java and Python: bytecode, virtual machines and just-in-time compiling.
بۆچی دەبێت وەربگێڕدرێت؛ و چۆن کار دەکەن، هەر یەکێکیان بۆ چی باشە و هەڵەیەک لە دێڕی 4دا چی بەسەر دێت؛ هەروەها تێکەڵە نوێیەکەی Java و Python: ، و .
What you will learnچی فێر دەبیت
- Explain why a high-level program must be translated before the CPU can run it.
- Describe how a compiler and an interpreter work, with their strengths and weaknesses.
- Predict what each does with a mistake in the middle of a program.
- Explain bytecode, virtual machines and JIT, and how Java and Python use them.
- ڕوونی بکەیتەوە بۆچی بە دەبێت پێش جێبەجێکردن لەلایەن وەربگێڕدرێت.
- وەسفی کارکردنی و بکەیت، لەگەڵ خاڵە بەهێز و لاوازەکانیان.
- پێشبینی بکەیت هەر یەکێکیان چی بە هەڵەیەک لە ناوەڕاستی دەکات.
- ، و JIT ڕوون بکەیتەوە و بڵێیت Java و Python چۆن بەکاریان دەهێنن.
Why code must be translatedبۆچی کۆد دەبێت وەربگێڕدرێت
You write source code in a high-level language, but the CPU can run only machine code — instructions in binary for its own CPU family (as you saw in What is programming?). So every program written in a high-level language must be translated into machine code before the CPU can carry it out.
تۆ بە دەنووسیت، بەڵام تەنها دەتوانێت جێبەجێ بکات: بۆ خێزانی خۆی (وەک لە بەرنامەسازی چییە؟ بینیت). کەواتە هەموو کە بە نووسرابێت دەبێت پێش ئەوەی جێبەجێی بکات وەربگێڕدرێت بۆ .
Two kinds of program do this translation: a compiler and an interpreter. Both turn a program written in a high-level language into machine code that the computer understands; they differ in when and how much they translate.
دوو جۆر ئەم وەرگێڕانە دەکەن: و . هەردووکیان کە بە نووسراوە دەکەن بە کە لێی تێدەگات؛ جیاوازییان لەوەدایە کەی و چەند وەردەگێڕن.
Why code must be translatedبۆچی کۆد دەبێت وەربگێڕدرێت
Two ways to translate: an analogyدوو ڕێگای وەرگێڕان: بەراوردێک
Think of a Kurdish novel that a publisher wants to sell in English. A translator can translate the whole book first, print it, and then thousands of people read it without the translator — that is a compiler. Or think of a doctor's visit with an interpreter sitting beside you, translating each sentence as soon as it is spoken — that is an interpreter: nothing is written down, and the interpreter must be there every time.
بیر لە ڕۆمانێکی کوردی بکەرەوە کە بڵاوکەرەوەیەک دەیەوێت بە ئینگلیزی بیفرۆشێت. وەرگێڕێک دەتوانێت سەرەتا هەموو کتێبەکە وەربگێڕێت و چاپی بکات، پاشان هەزاران کەس بەبێ وەرگێڕەکە دەیخوێننەوە: ئەمە . یان بیر لە سەردانی پزیشک بکەرەوە کە وەرگێڕێک لە تەنیشتتەوە دانیشتووە و هەر ڕستەیەک یەکسەر دوای وتنی وەردەگێڕێت: ئەمە ؛ هیچ شتێک نانووسرێتەوە و وەرگێڕەکە دەبێت هەموو جارێک ئامادە بێت.
Where the analogy stops workingسنووری ئەم نموونەیە
A book is translated for people, who could guess a missing word. A compiler or an interpreter must be perfectly exact, and modern languages often mix the two ideas, as you will see.
کتێب بۆ مرۆڤ وەردەگێڕدرێت کە دەتوانێت وشەیەکی ونبوو مەزەندە بکات. یان دەبێت تەواو ورد بێت و زمانە نوێیەکان زۆرجار هەردوو بیرۆکەکە تێکەڵ دەکەن، وەک دواتر دەیبینیت.
The compiler: translate everything firstکۆمپایلەر: سەرەتا هەمووی وەربگێڕە
A compiler reads the whole program and translates it into machine code before anything runs. The result is usually saved as object code and then as an executable file, such as hello.exe on Windows. After that you run the executable as often as you like — the compiler and the source code are no longer needed.
هەموو دەخوێنێتەوە و پێش ئەوەی هیچ شتێک جێبەجێ بێت وەری دەگێڕێت بۆ . ئەنجامەکە زۆرجار وەک و پاشان وەک پاشەکەوت دەکرێت، وەک hello.exe لە Windowsـدا. دوای ئەوە چەند جار بتەوێت جێبەجێ دەکەیت؛ ئیتر نە و نە پێویست نین.
- Fast programs. Compiled programs tend to be faster and more efficient than interpreted ones: the translation is done once, ahead of time, and the compiler can study the whole program and improve the machine code it produces.
- Errors before running. Grammar mistakes anywhere in the program are reported before any line runs.
- A wait after every change. You must compile again each time you change the code; big programs can take minutes.
- One platform per executable. An executable made for Windows on an Intel or AMD processor does not run on an Android phone or a Mac with an Apple chip; you compile again for each platform.
- خێرا. زۆرجار لە ئینتەرپرێتکراوەکان خێراتر و کاراترن: وەرگێڕان یەک جار و پێشوەختە دەکرێت و دەتوانێت هەموو بخوێنێتەوە و ئەو دروستی دەکات باشتر بکات.
- هەڵە پێش جێبەجێکردن. لە هەر شوێنێکی بن پێش جێبەجێبوونی هیچ دێڕێک ڕادەگەیەنرێن.
- چاوەڕوانی دوای هەر گۆڕانکارییەک. هەر جارێک کۆدەکە دەگۆڕیت دەبێت دووبارە کۆمپایلی بکەیتەوە؛ دەکرێت چەند خولەکێک بخایەنن.
- یەک بۆ هەر . کە بۆ Windows لەسەر پرۆسێسەری Intel یان AMD دروست کرابێت لەسەر مۆبایلێکی Android یان Macـێکی Apple کار ناکات؛ بۆ هەر دووبارە کۆمپایل دەکەیت.
See the difference between source code and machine code, and how a compiler turns what people write into what the CPU runs.
جیاوازیی نێوان و دەبینیت و چۆن ئەوەی مرۆڤ دەینووسێت دەکاتە شتێک کە جێبەجێی دەکات.
Watch 3:38-10:39: a compiler translates source code to machine code, and why that makes programming easier.
لە 3:38 تا 10:39 سەیر بکە: وەردەگێڕێت بۆ و بۆچی ئەمە ئاسانتر دەکات.
The interpreter: one statement at a timeئینتەرپرێتەر: هەر جارە ڕستەیەک
An interpreter translates the program one statement at a time and runs each statement at once. It reads a statement, translates it, runs it, then moves to the next. It does not produce a separate machine-code file: to run the program again, you need the source code and the interpreter.
هەر جارە وەردەگێڕێت و یەکسەر جێبەجێی دەکات. دەخوێنێتەوە، وەری دەگێڕێت، جێبەجێی دەکات، پاشان دەچێتە سەر دواتر. هیچ جیای دروست ناکات: بۆ دووبارە جێبەجێکردنی ، و پێویستە.
- Quick to start. An interpreter takes little time to analyse the source code before it starts, so you see results immediately — handy while learning and testing ideas.
- Slower overall. The total running time is usually longer than for compiled code, because the translating work happens while the program runs — and a statement inside a loop that runs a thousand times may be translated a thousand times.
- Stops at the first failing statement. Statements before it have already run.
- دەستپێکردنی خێرا. پێش دەستپێکردن کاتێکی کەم بۆ شیکردنەوەی بەسەر دەبات، بۆیە یەکسەر ئەنجام دەبینیت؛ لە کاتی فێربوون و تاقیکردنەوەی بیرۆکەدا بەسوودە.
- بە گشتی هێواشتر. کۆی ئەو کاتەی جێبەجێکردن دەیخایەنێت زۆرجار لە کۆدی کۆمپایلکراو زیاترە، چونکە کاری وەرگێڕان لە کاتی کارکردنی ڕوو دەدات و لە ناو کە هەزار جار جێبەجێ دەبێت لەوانەیە هەزار جار وەربگێڕدرێت.
- لە یەکەم شکستخواردوودا دەوەستێت. پێشووتر پێشتر جێبەجێ بوون.
The interpreter: one statement at a timeئینتەرپرێتەر: هەر جارە ڕستەیەک
A mistake on line 4هەڵەیەک لە دێڕی 4دا
The two classic models behave very differently when the program has a mistake. Here is a five-line program in pseudocode with a typo on line 4: shwo instead of show. Watch what a compiler and an interpreter do with it.
هەردوو مۆدێلە کلاسیکییەکە کاتێک هەڵەی تێدایە زۆر جیاواز ڕەفتار دەکەن. ئەمە پێنج دێڕییە بە کە لە دێڕی 4دا هەڵەیەکی نووسینی تێدایە: shwo لە جیاتی show. سەیر بکە و چی پێ دەکەن.


Compiler and interpreter comparedبەراوردی کۆمپایلەر و ئینتەرپرێتەر
| Pointخاڵ | Compiler | Interpreter |
|---|---|---|
| Translatesچی وەردەگێڕێت | the whole program, before runningهەموو ، پێش جێبەجێکردن | one statement at a time, while runningهەر جارە ، لە |
| Producesچی دروست دەکات | object code and an executable file و | no separate machine-code fileهیچ جیای |
| Start-upدەستپێکردن | wait for compiling firstسەرەتا چاوەڕێی کۆمپایلکردن | starts at onceیەکسەر دەست پێ دەکات |
| Running speedخێرایی جێبەجێکردن | usually fasterزۆرجار خێراتر | usually slowerزۆرجار هێواشتر |
| Grammar errors | all reported before runningهەموویان پێش جێبەجێکردن ڕادەگەیەنرێن | found when that statement is reachedکاتێک دەگاتە ئەو دەدۆزرێتەوە |
| To share the programبۆ بڵاوکردنەوەی | give the executable (one per platform) بدە (یەکێک بۆ هەر ) | give the source code; users need the interpreter بدە؛ بەکارهێنەران پێویستە |
In Kurdish: what a computer language is, what a high-level language is, and the difference between an interpreter and a compiler.
بە کوردی: زمانی چییە، چییە و جیاوازیی نێوان و .
Kurdish video from 3:34: compiler vs interpreter, which is better, languages that use each one or both.
ڤیدیۆیەکی کوردی، لە 3:34 بەدواوە: بەرامبەر ، کامیان باشترە و ئەو زمانانەی یەکێکیان یان هەردووکیان بەکاردەهێنن.
The modern way: bytecode and virtual machinesڕێگای نوێ: بایتکۆد و ئامێرە گریمانەییەکان
Most popular languages today use a third way that mixes the two. A compiler first translates the source code into bytecode: a compact list of simple instructions that is not machine code for any real CPU. Then a virtual machine — a computer made of software — runs the bytecode on the real CPU.
زۆربەی زمانە بەناوبانگەکانی ئەمڕۆ ڕێگایەکی سێیەم بەکار دەهێنن کە هەردووکیان تێکەڵ دەکات. سەرەتا وەردەگێڕێت بۆ : لیستێکی چڕی سادە کە هیچ ڕاستەقینە نییە. پاشان (کۆمپیوتەرێک کە لە دروست کراوە) لەسەر ڕاستەقینە جێبەجێ دەکات.
- Portable. The same bytecode runs on every computer that has the virtual machine, so you do not compile again for each platform.
- Faster than pure interpreting. The hard part of translation (checking grammar, building instructions) is done once, ahead of time.
- Even faster with JIT. Many virtual machines watch which parts run most and compile those parts to real machine code while the program runs.
- گوازراوە. هەمان لەسەر هەموو کە هەبێت کار دەکات، بۆیە بۆ هەر دووبارە کۆمپایل ناکەیت.
- خێراتر لە ئینتەرپرێتی ڕووت. بەشە قورسەکەی وەرگێڕان (پشکنینی ، دروستکردنی ) یەک جار و پێشوەختە دەکرێت.
- خێراتریش بە JIT. زۆر سەیر دەکەن کام بەشانە زۆرتر جێبەجێ دەبن و ئەو بەشانە لە کاتی کارکردنی دەکەن بە ڕاستەقینە.
The modern way: bytecode and virtual machinesڕێگای نوێ: بایتکۆد و ئامێرە گریمانەییەکان
Java: compile with javac, run on the JVMJava: بە javac کۆمپایل بکە، لەسەر JVM جێبەجێی بکە
In Java you do the compiling yourself. The command javac Main.java reads the source file and writes the class file Main.class, which contains bytecode. The command java Main starts the Java Virtual Machine (JVM), which runs that bytecode. You can copy the same .class file to Windows, macOS or Linux, and it runs wherever a JVM is installed — Java's slogan “write once, run anywhere”.
لە Javaـدا کۆمپایلکردن خۆت دەیکەیت. javac Main.java سەرچاوەکە دەخوێنێتەوە و Main.class دەنووسێت کە تێدایە. java Main Java (JVM) دەست پێ دەکات کە ئەو جێبەجێ دەکات. دەتوانیت هەمان .class بۆ Windows، macOS یان Linux کۆپی بکەیت و لە هەر شوێنێک JVM دامەزرابێت کار دەکات: دروشمی Java «یەک جار بنووسە، لە هەموو شوێنێک جێبەجێی بکە».
The JVM starts by interpreting the bytecode. When it notices that a method has run many times, it compiles that method to machine code with its just-in-time (JIT) compiler, and from then on the method runs at full speed.
JVM بە ئینتەرپرێتکردنی دەست پێ دەکات. کاتێک دەبینێت چەندین جار جێبەجێ بووە، بە ئەو دەکات بە و لەوە بەدواوە بە تەواوی خێرایی جێبەجێ دەبێت.
The modern way: bytecode and virtual machinesڕێگای نوێ: بایتکۆد و ئامێرە گریمانەییەکان
Python: compiled for you, every timePython: هەموو جارێک بۆت کۆمپایل دەکرێت
Python is usually called interpreted, but the standard Python (CPython, the one from python.org) works in two steps. When you run a file, it first compiles the whole file to bytecode — you never see this step. Then the Python virtual machine runs the bytecode. For files that your program imports, CPython saves the bytecode in .pyc files inside a __pycache__ folder, so the next start is faster.
Python زۆرجار پێی دەوترێت ئینتەرپرێتکراو، بەڵام Pythonـی ستاندارد (CPython، ئەوەی لە python.org) بە دوو هەنگاو کار دەکات. کاتێک جێبەجێ دەکەیت، سەرەتا هەموو بۆ کۆمپایل دەکات؛ تۆ هەرگیز ئەم هەنگاوە نابینیت. پاشان Python جێبەجێ دەکات. بۆ ئەو هاوردەیان دەکات، CPython لە .pyc لە ناو __pycache__ـدا پاشەکەوت دەکات، بۆ ئەوەی جاری داهاتوو خێراتر دەست پێ بکات.
- Python's bytecode is an internal detail: it can change between Python versions, so you share
.pysource files, not.pycfiles. - Since Python 3.13 some CPython builds include an experimental JIT compiler; in Python 3.15 (2026) it is still experimental. Other Pythons, such as PyPy, have used a JIT for years.
- That is why Python's own glossary says the difference between interpreted and compiled languages “can be blurry”.
- Python وردەکارییەکی ناوخۆییە: دەکرێت لە نێوان Pythonـدا بگۆڕێت، بۆیە سەرچاوەی
.pyبڵاو دەکەیتەوە، نەک.pyc. - لە Python 3.13ـەوە هەندێک CPython JITـی تاقیکارییان تێدایە؛ لە Python 3.15دا (2026) هێشتا تاقیکارییە. Pythonـەکانی تر، وەک PyPy، چەندین ساڵە JIT بەکار دەهێنن.
- بۆیە فەرهەنگۆکی خودی Python دەڵێت جیاوازیی نێوان زمانی ئینتەرپرێتکراو و کۆمپایلکراو «دەکرێت ناڕوون بێت».
The modern way: bytecode and virtual machinesڕێگای نوێ: بایتکۆد و ئامێرە گریمانەییەکان
Just-in-time compilingکۆمپایلکردنی کاتی جێبەجێکردن
Turning into while the program is running — for the parts that run most often — so that they run much faster. The Java virtual machine does this, and newer Python versions include an experimental JIT.
گۆڕینی بۆ لە کاتێکدا کار دەکات، بۆ ئەو بەشانەی زۆرتر جێبەجێ دەبن، بۆ ئەوەی زۆر خێراتر کار بکەن. Java ئەمە دەکات و وەشانە نوێیەکانی Pythonـیش JITـێکی تاقیکارییان تێدایە.
A new waiter in a busy tea house checks with the owner every time someone orders the house special. After the tenth time he writes the recipe on a card and makes it straight away. A JIT compiler does the same: at first the virtual machine interprets the bytecode, but code that runs again and again is compiled once to machine code and then runs fast.
گارسۆنێکی نوێ لە چایخانەیەکی قەرەباڵغ هەر جارێک کەسێک خواردنەوە تایبەتەکەی چایخانەکە داوا دەکات لە خاوەنەکەی دەپرسێت. دوای جاری دەیەم ڕێگای دروستکردنەکەی لەسەر کارتێک دەنووسێت و یەکسەر دروستی دەکات. JIT هەمان کار دەکات: سەرەتا ئینتەرپرێت دەکات، بەڵام ئەو کۆدەی دووبارە و دووبارە جێبەجێ دەبێت یەک جار دەکرێت بە و پاشان خێرا کار دەکات.
Where the analogy stops workingسنووری ئەم نموونەیە
The waiter remembers only the popular orders; a JIT also compiles only the busy parts, because compiling takes time too. Code that runs once is simply interpreted.
گارسۆنەکە تەنها داواکارییە بەناوبانگەکان لەبەر دەکات؛ JITـیش تەنها بەشە زۆربەکارهاتووەکان کۆمپایل دەکات، چونکە کۆمپایلکردنیش کاتی دەوێت. ئەو کۆدەی تەنها یەک جار جێبەجێ دەبێت تەنها ئینتەرپرێت دەکرێت.
The middle way between compiling and interpreting: code becomes an intermediate language that a just-in-time compiler turns into machine code; Java, C# and Python examples.
ڕێگەی ناوەڕاست لە نێوان کۆمپایلکردن و ئینتەرپرێتکردندا: کۆد دەبێتە زمانێکی ناوەندی و پاشان بە دەکرێتە ؛ نموونەکانی ، C# و .
Watch from 3:35: the intermediate approach with a JIT compiler, and which languages are compiled, interpreted or hybrid.
لە 3:35 بەدواوە سەیر بکە: ڕێگە ناوەندییەکە بە JIT، پاشان کام زمان کۆمپایل دەکرێت، کام ئینتەرپرێت دەکرێت و کامیان تێکەڵە.
The modern way: bytecode and virtual machinesڕێگای نوێ: بایتکۆد و ئامێرە گریمانەییەکان
Which languages are “interpreted” today?ئەمڕۆ کام زمانانە «ئینتەرپرێتکراو»ن؟
Online “compilers”کۆمپایلەرە ئۆنلاینەکان
Websites such as programiz.com let you type code in a browser — even on a phone — press Run and see the output, without installing anything. Many call themselves an “online compiler”, even for Python. One site's own heading says “online compiler (interpreter)”, which is honest: your Python code is sent to the website's server (or run inside the browser), where an ordinary Python interpreter compiles it to bytecode and runs it.
وەک programiz.com ڕێگەت پێ دەدەن کۆد لە بنووسیت، تەنانەت لەسەر مۆبایل، Run دابگریت و ببینیت، بەبێ هیچ شتێک. زۆریان خۆیان ناو دەنێن « ئۆنلاین»، تەنانەت بۆ Pythonـیش. سەردێڕی یەکێک لە دەڵێت « ئۆنلاین ()»، کە ڕاستگۆیانەیە: کۆدی Pythonـەکەت دەنێردرێت بۆ (یان لە ناو جێبەجێ دەکرێت)، لەوێ ئاسایی Python بۆ کۆمپایلی دەکات و جێبەجێی دەکات.
Common mistakesهەڵە باوەکان
| Mistaken ideaبیرۆکەی هەڵە | What is trueڕاستییەکە |
|---|---|
| “Python is interpreted, so it never compiles.”«Python ئینتەرپرێت دەکرێت، کەواتە هەرگیز کۆمپایل ناکات.» | CPython compiles every file to bytecode before running it.CPython پێش جێبەجێکردن هەموو بۆ کۆمپایل دەکات. |
| “javac turns Java into machine code.”«javac کۆدی Java دەکات بە .» | javac makes bytecode (.class files); the JVM runs it and may JIT-compile parts.javac دروست دەکات ( .class)؛ JVM جێبەجێی دەکات و لەوانەیە هەندێک بەشی JIT بکات. |
| “A compiled program cannot have errors.”« کۆمپایلکراو هەڵەی تێدا نابێت.» | The compiler finds grammar errors only. Runtime errors and logic errors can still happen. تەنها دەدۆزێتەوە. و هێشتا ڕوو دەدەن. |
| “An .exe file runs on any computer.”« .exe لەسەر هەموو کار دەکات.» | It runs only on the CPU type and operating system it was compiled for.تەنها لەسەر ئەو جۆرە و بۆی کۆمپایل کراوە کار دەکات. |
| “Interpreters always use less memory.”« هەمیشە کەمتر بەکار دەهێنن.» | The interpreter itself is in memory while the program runs; there is no such rule. خۆی لە کاتی کارکردنی لە ؛ یاسایەکی وەها نییە. |
| “Share the .pyc file instead of the .py file.”«لە جیاتی .py .pyc بڵاو بکەرەوە.» | .pyc bytecode can change between Python versions. Share the .py source. .pyc دەکرێت لە نێوان Pythonـدا بگۆڕێت. سەرچاوەی .py بڵاو بکەرەوە. |
Exercisesڕاهێنانەکان
Name the model in each case — compiler, interpreter, or bytecode + virtual machine: (a) A game studio sends players a ready-made .exe file. (b) A shell script is read and run line by line by the system shell. (c) A team copies one .class file to Windows and Linux servers and runs it with java.
لە هەر حاڵەتێکدا ناوی مۆدێلەکە بنووسە: ، یان + : (أ) ستۆدیۆیەکی یاری ئامادەی .exe دەنێرێت بۆ یاریزانان. (ب) shell دێڕ بە دێڕ لەلایەن shellـی سیستەمەکەوە دەخوێنرێتەوە و جێبەجێ دەکرێت. (ج) تیمێک یەک .class بۆ Windows و Linux کۆپی دەکات و بە java جێبەجێی دەکات.
Show answerوەڵامەکە پیشان بدە
(a) compiler — the machine code was made ahead of time; (b) interpreter; (c) bytecode + virtual machine — the same bytecode runs on any JVM.
(أ) : پێشوەختە دروست کراوە؛ (ب) ؛ (ج) + : هەمان لەسەر هەر JVMـێک کار دەکات.
This pseudocode program has a mistake on line 3 that is found only while it runs (it divides by zero). What does a classic interpreter show? Then imagine line 3 has a grammar mistake instead (shwo): what does a compiler show?
ئەم بە لە دێڕی 3دا هەڵەیەکی تێدایە کە تەنها لە دەدۆزرێتەوە (دابەشکردن بەسەر سفردا). کلاسیک چی پیشان دەدات؟ پاشان وا دابنێ دێڕی 3 لە جیاتی ئەوە هەیە (shwo): چی پیشان دەدات؟
1 show "Start"
2 show 10 / 2
3 show 10 / 0
4 show "End"Show answerوەڵامەکە پیشان بدە
The interpreter runs lines 1 and 2, so it shows Start and 5, then stops with an error on line 3; End never appears. With a grammar mistake on line 3, the compiler reports the error before running anything, so nothing is shown at all.
دێڕی 1 و 2 جێبەجێ دەکات، بۆیە Start و 5 پیشان دەدات، پاشان بە هەڵەیەک لە دێڕی 3دا دەوەستێت؛ End هەرگیز دەرناکەوێت. ئەگەر لە دێڕی 3دا هەبێت، پێش جێبەجێکردنی هەر شتێک هەڵەکە ڕادەگەیەنێت، بۆیە هیچ شتێک پیشان نادرێت.
Karwan compiled a C program on his Windows laptop and sent game.exe to Lana, who has a Mac with an Apple chip. It does not run. Explain why, and give two ways to fix it.
کاروان C لەسەر لاپتۆپە Windowsـەکەی کۆمپایل کرد و game.exeـی بۆ لانا نارد کە Macـێکی Appleـی هەیە. کار ناکات. ڕوونی بکەرەوە بۆچی و دوو ڕێگا بۆ چارەسەرکردنی بڵێ.
Show answerوەڵامەکە پیشان بدە
The executable holds machine code for one CPU family and one operating system (Windows on an Intel or AMD processor). The Mac has a different CPU and a different operating system. Fixes: compile the source code again on or for a Mac, or write the program in a bytecode language such as Java, whose single .class file runs on any computer with a JVM.
یەک خێزانی و یەک تێدایە (Windows لەسەر پرۆسێسەری Intel یان AMD). Mac و جیاوازی هەیە. چارەسەر: لەسەر Mac یان بۆ Mac دووبارە کۆمپایل بکە، یان بە زمانێکی وەک Java بنووسە کە یەک .classـی لەسەر هەموو کە JVMـی هەبێت کار دەکات.
Rewrite this sentence so that it is correct: “Interpreters generate no object code, hence they are memory efficient. JavaScript, Python and Ruby use interpreters.”
ئەم ڕستەیە بە شێوەیەکی ڕاست بنووسەرەوە: « هیچ دروست ناکەن، بۆیە بۆ کاران. JavaScript، Python و Ruby بەکار دەهێنن.»
Show answerوەڵامەکە پیشان بدە
For example: “An interpreter saves no separate object-code file, but it must itself be in memory while the program runs, so it does not necessarily use less memory. Today JavaScript, Python and Ruby are usually compiled to bytecode first, and their engines may also use JIT compilers.”
بۆ نموونە: « هیچ جیای پاشەکەوت ناکات، بەڵام خۆی دەبێت لە کاتی کارکردنی لە بێت، بۆیە پێویست نییە کەمتر بەکار بهێنێت. ئەمڕۆ JavaScript، Python و Ruby زۆرجار سەرەتا بۆ کۆمپایل دەکرێن و بزوێنەرەکانیان لەوانەیە JITـیش بەکار بهێنن.»
Summaryپوختە
- The CPU runs only machine code, so source code must be translated by a compiler or an interpreter.
- A compiler translates the whole program first into an executable; it runs fast, finds grammar errors early, and works on one platform.
- An interpreter translates and runs one statement at a time; it starts quickly, runs more slowly and stops at the first failing statement.
- Java, Kotlin, C# and Python compile to bytecode that a virtual machine runs; JIT compilers speed up the busy parts.
- Java: javac → .class → JVM. Python: compiled automatically to bytecode (.pyc for imported files) → Python VM.
- تەنها جێبەجێ دەکات، بۆیە دەبێت لەلایەن یان وەربگێڕدرێت.
- سەرەتا هەموو وەردەگێڕێت بۆ ؛ خێرا کار دەکات، زوو دەدۆزێتەوە و لەسەر یەک کار دەکات.
- هەر جارە وەردەگێڕێت و جێبەجێی دەکات؛ خێرا دەست پێ دەکات، هێواشتر کار دەکات و لە یەکەم شکستخواردوودا دەوەستێت.
- Java، Kotlin، C# و Python بۆ کۆمپایل دەکەن کە جێبەجێی دەکات؛ JIT بەشە زۆربەکارهاتووەکان خێرا دەکەن.
- Java: javac، پاشان .class، پاشان JVM. Python: بە خۆکاری بۆ کۆمپایل دەکرێت (.pyc بۆ )، پاشان Python VM.
What is the main difference between a compiler and an interpreter?جیاوازیی سەرەکیی نێوان کۆمپایلەر و ئینتەرپرێتەر چییە؟
A compiler translates the whole program before running it; an interpreter translates and runs one statement at a time.
پێش جێبەجێکردن هەموو وەردەگێڕێت؛ هەر جارە وەردەگێڕێت و جێبەجێی دەکات.
What is bytecode, and what runs it?بایتکۆد چییە و چی جێبەجێی دەکات؟
A compact list of simple instructions made by a compiler, not real machine code; a virtual machine runs it.
لیستێکی چڕی سادەیە کە دروستی دەکات و ڕاستەقینە نییە؛ جێبەجێی دەکات.
Why is Python's interpreted-or-compiled label “blurry”?بۆچی ناوی ئینتەرپرێتکراو یان کۆمپایلکراو بۆ Python «ناڕوونە»؟
Because CPython compiles source code to bytecode and then interprets the bytecode on its virtual machine.
چونکە CPython بۆ کۆمپایل دەکات و پاشان لەسەر ئینتەرپرێت دەکات.
Videoڤیدیۆ
Watch a videoسەیری ڤیدیۆیەک بکە
A video that viewers liked a lot and praised in their comments, chosen for this lesson.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.
A translated-book analogy for compilers and interpreters, their pros and cons, and hybrid languages that mix both.
بە نموونەی کتێبێکی وەرگێڕدراو و ڕوون دەکاتەوە، لەگەڵ سوود و کەموکوڕییەکانیان و ئەو زمانە تێکەڵانەی هەردوو ڕێگە بەکاردەهێنن.
Whole video: compiled languages (1:05), interpreted languages, pros and cons, hybrid languages (4:15).
هەموو ڤیدیۆکە: زمانە کۆمپایلکراوەکان (1:05)، زمانە ئینتەرپرێتکراوەکان، سوود و کەموکوڕییەکان و زمانە تێکەڵەکان (4:15).
Lesson complete!وانەکە تەواو بوو!
Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.
Key termsزاراوە سەرەکییەکان
Algorithms, Pseudocode and Flowchartsئەلگۆریزمەکان، نیمچەکۆد و هێڵکارییەکانی ڕەوت
Related lecturesوانە پەیوەندیدارەکان
References and further readingسەرچاوەکان و خوێندنەوەی زیاتر
- Python documentation: glossary (bytecode, interpreted, virtual machine, CPython)
- Python documentation: dis — disassembler for Python bytecode (bytecode is an implementation detail)
- Python documentation: What's New in Python 3.13 (experimental JIT compiler)
- Python tutorial: Using the Python interpreter
- Oracle: The javac command (Java SE 21)
- Oracle: HotSpot compilation optimization (interpreting first, JIT-compiling busy methods)
- V8 blog: Launching Ignition and TurboFan (bytecode interpreter and optimizing compiler)
- Ruby documentation: YJIT
- What's New in Python 3.15 (the JIT compiler is still experimental)
This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.