Language translators and IDEs
הוצג
19:11
מערכות הפעלה
מעולם לא ראיתם זאת, ולא תראו לעולם — אך היא תמיד קיימת. מאחורי כל אפליקציה שתפתחו, כל קובץ שתשמרו, כל לחיצה על המסך, נמצא דבר בלתי נראה…
קריינות באנגלית · כתוביות באנגלית ובסינית 中文 שאפשר להחליף ביניהן
בשיעור הזה
| English | משמעות |
|---|---|
| compiler/kəmˈpaɪlə/ | מתרגם |
| programmer | A person who writes and develops computer programs. |
| machine instructions | Commands in machine code that a processor can execute directly. |
| arithmetic/əˈrɪθmətɪk/ | Calculations with numbers, such as adding and subtracting. |
| source code/sɔːs kəʊd/ | קוד מקור |
| translator/trænˈsleɪtə/ | מתרגם |
| machine code/məˈʃiːn kəʊd/ | קוד מכונה |
| processor/ˈprəʊsesə/ | The component that executes instructions and performs the operations of a computer or similar system. |
| compiling | The process of translating a whole program before it runs. |
| interpreting | The process of translating and executing a program one statement at a time. |
| assembler/əˈsemblə/ | אסמבלר |
| assembly language/əˈsemblɪ ˈlæŋɡwɪdʒ/ | שפת אסמבלר |
| mnemonic instruction | An assembly language command that uses a short word for an operation. |
| labels/ˈleɪblz/ | Names used to mark positions in a program's code. |
| symbolic addresses | Names used to refer to memory locations instead of their actual addresses. |
| addresses | Numbers that identify specific locations in a computer's memory. |
| hardware/ˈhɑːdweə/ | The physical parts of a computer system that can be touched. |
| device drivers/dɪˈvaɪs ˈdraɪvəz/ | Programs that allow an operating system to control hardware devices. |
| embedded systems | Computers built into larger devices to perform specific tasks. |
| loops | Parts of a program that repeat instructions a number of times or until a condition is met. |
| high-level program | A program written in a language designed to be easier for people to understand. |
| object code/ˈɒbdʒekt kəʊd/ | קוד מוצר |
| executable/ɪɡˈzekjʊtəbl/ | קובץ תוכנית ביצוע |
| syntax errors | Mistakes that break the rules for writing code in a programming language. |
| run time/rʌn taɪm/ | The period during which a program is running on a computer. |
| operating system/ˈɒpəreɪtɪŋ ˈsɪstəm/ | System software that manages hardware resources and provides services for applications. |
| interpreter/ɪnˈtɜːprɪtə/ | מפרש |
| statement/ˈsteɪtmənt/ | A line of code that tells a program what to do. |
| execution speed | The rate at which a computer carries out a program's instructions. |
| portability | The ability of a program to run on different platforms. |
| platform/ˈplætfɔːm/ | The combination of processor and operating system on which a program runs. |
| debugging/ˈdiːbʌɡɪŋ/ | The process of finding and correcting errors in a program. |
| bytecode/ˈbaɪtkəʊd/ | בייטקוד |
| portable/ˈpɔːtəbl/ | נייד |
| virtual machine/ˈvɜːtʃuːəl məˈʃiːn/ | מכונה וירטואלית |
| just-in-time compilation/dʒʌst ɪn taɪm ˌkɒmpɪˈleɪʃn/ | הרכבה בזמן אמת |
| native code | Machine code that can run directly on a particular processor. |
| console mode | A way of running a program using text input and output. |
| command line | A place where users type text commands to interact with a computer. |
| integrated development environment/ˈɪntɪɡreɪtɪd dɪˈveləpmənt enˈvaɪrənmənt/ | סביבת פיתוח משולבת |
| context-sensitive prompts/ˈkɒntekst ˈsensɪtɪv prɒmpts/ | הנחיות תלויות בהקשר |
| identifiers | Names chosen by programmers for parts of a program. |
| keywords/ˈkiːwɜːdz/ | Words with special meanings that are part of a programming language. |
| parameters/pəˈræmɪtəz/ | Values that specify a model or function, or named inputs that a subroutine receives. |
| auto-complete/ˈɔːtəʊ kəmˈpliːt/ | השלמה אוטומטית |
| dynamic syntax checks/daɪˈnæmɪk ˈsɪntæks tʃeks/ | בדיקות סינטקס דינמיות |
| prettyprint/ˈpretɪprɪnt/ | הדפסה נקייה |
| strings/strɪŋz/ | Sequences of characters used as text in a program. |
| comments/ˈkɒments/ | Explanatory text in source code or markup that does not execute as a program instruction. |
| indentation/ˌɪndenˈteɪʃn/ | Space placed at the start of a line to show structure, including code blocks in languages that use it syntactically. |
| expand and collapse | A feature that shows or hides sections of code. |
| block/blɒk/ | A group of statements treated as a single section of code. |
| breakpoints/ˈbreɪkpɔɪnts/ | נקודות עצירה |
| single stepping/ˈsɪŋɡl ˈstepɪŋ/ | צעד אחד |
| variables/ˈveərɪəblz/ | A quantity or named value that can change or take different values. |
| expressions | Combinations of values and operations that produce a value. |
| report window/rɪˈpɔːt ˈwɪndəʊ/ | חלון דוח |
| warnings | Messages that point out possible problems in a program. |
| function/ˈfʌŋkʃn/ | A mapping that assigns exactly one output to each allowed input. |
| logic error/ˈlɒdʒɪk ˈerə/ | A mistake in an algorithm or program that produces an incorrect result despite valid syntax. |
| run-time error messages | Messages that report errors occurring while a program is running. |
אף אחד לא האמין שהמחשב יכול לכתוב את התוכנה שלו
- בשנת 1952 גרייס הופר בנתה את ה-compiler הראשון, תוכנית שהפכה סימנויות של מתכנת להוראות מכונה. "אף אחד לא האמין לכך," אמרה מאוחר יותר. "הייתה לי compiler פעילה ואף אחד לא רצה לגעת בה. הם אמרו לי שמחשבים יכולים רק לבצע חישובים."
- כל שפה השתמשת בה מאז מבוססת על רעיון זה: אתה כותב source code לאנשים, ומתרגם מייצר את ה-machine code שהמעבד מפעיל.
- ישנם שלושה סוגי מתרגמים ואחד היברידי מפורסם, והמבחן דורש ממך לומר מתי ולמה להשתמש בכל אחד מהם.
- שיעור זה עוסק במתרגמים, במגבלות בין compiling ל-interpreting, בשילוב של Java בין שניהם ובכלים שה-IDE מספק סביבם.
source code, machine code וה-assembler
- המעבד מבצע רק machine code. מתרגם ממיר תוכנית שנכתבה לאנשים אליה.
- assembler ממיר assembly language למכונה: כל הוראת mnemonic,
LDD,ADD,JMP, הופכת בדיוק להוראת machine code אחת, ותוויות ומיקודים סמליים מוחלפים על ידי מיקודים אמיתיים. - Assembly משמש כאשר המתכנת זקוק לשליטה ישירה בחומרה: drivers של מכשירים, מערכות embedded, הלולאות הפנימיות ביותר של משחק.
Match each translator to what it does.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Assembler: assembly→machine code; compiler: all-at-once to an executable; interpreter: line by line at run time.
ה-compiler
- compiler ממיר את כל התוכנית ברמה גבוהה למכונה, object code, לפני שהיא מופעלת. הוא מייצר קובץ executable מדווח על כל שגיאות הסינטקס יחד, כרשימה, בסוף הה-mapping.
- הוא לא מפעיל את התוכנית. ברגע שהקוד נקי, ה-executable מופעל ללא ה-compiler מותקן, כל כך הרבה פעמים כפי שתרצה.
- מהיר בזמן הריצה, מכיוון שאין טרנסלציה בעת הריצה; אך ה-machine code קשור למעבד ומערכת הפעלה אחד.
The compiler route: source to running program
Step through how a compiler works — translating the whole program once, before it runs. Contrast it with an interpreter, which translates and runs one line at a time.
A compiler differs from an interpreter because it:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
A compiler translates all at once into an executable that runs without the compiler. An interpreter runs line by line.
Put the compiler route in order, from writing code to running it.
רמת קושי 3/5 · 200 מטבעות + בונוס קטן בהשלמה הראשונה היום
A compiler translates the whole program once into an executable; that file then runs without the compiler.
ה-interpreter
- Interpreter ממיר הוראה אחת בתוכנית ברמה גבוהה בפעם אחת ומפעיל אותה מיד לפני מעבר להבאה.
- אין קובץ executable שמיוצר. הוא עצור ב-השגיאה הראשונה שהוא נתקל בה ומדווח עליה, עם הקו, כדי שתתקן אותה ותפעיל מחדש.
- גם ה-source code וגם ה-Interpreter חייבים להיות קיימים בכל פעם שהתוכנית מופעלת, וכל פעלת re-translates, כך שהביצועים איטיים יותר; אך אותו source code פועל בכל מקום שיש בו interpreter.

כתוב פעם אחת והפעל, או תרגם בזמן אמת

When does an interpreter report an error?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
An interpreter runs line by line, so it reports an error at the moment it reaches that line — handy during development.
An interpreter produces no stand-alone executable, so the interpreter itself must be installed to run the program.
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
An interpreter translates and runs line by line each time — there is no separate executable to ship, unlike a compiler.
יתרונות וחסרונות, כפי שהם מופיעים במפת הסימון
| קומפילר | אינטרפרטר | |
|---|---|---|
| מהירות ביצוע | מהירה, קוד מכונה מוכן | איטית יותר, מתורגמת בכל ריצה |
| מה שמשתמש צריך | רק את הקובץ לביצוע; המקור נשאר פרטי | את קוד המקור ואת האינטרפרטר |
| זיהוי שגיאות | כולן מצויות יחד לאחר התרגום | כל שגיאה מדווחת בשורה בה, בעת הפיתוח |
| שינוי בקוד | לקומפילר את כל התוכנה | לערוך ולהריץ מחדש מיידית |
| ניידות | פלטפורמה אחת; לקומפילר מחדש לכל אחת | רץ בכל מקום בו קיים אינטרפרטר |

You should choose a compiler when:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Compiled executables are fast and stand-alone. Interpreters suit quick development and portable scripts.
Which points favour using an interpreter while developing a program? Select כולם that apply.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Fast edit-run cycles and errors at their line are the interpreter's strengths. Run-time speed is the compiler's.
דוגמה מופרדת: אינטרפרטר בזמן הכתיבה, קומפילר בסיום
- מפתח משתמש באינטרפרטר בזמן כתיבת תוכנית ובקומפילר כאשר היא מוגמרת. הסבר כיצד משתמשים בכל אחד מהם. [4]
- במהלך הפיתוח, האינטרפרטר מרץ את החלק החסר בתוכנית מיד, בלי להמתין לתרגום מלא. כאשר הוא נתקל בשגיאה, הוא מדווח על השורה, כך שהמפתח מתקן אותה ומריץ מחדש מיידית: מחזור עריכה-הרצה מהיר שמקל על תיקון שגיאות.
- כאשר התוכנית מוגמרת, הקומפילר מתרגם את כל התוכנה לקובץ ביצוע הנרץ מהר יותר, אינו דורש מתרגם במחשב המשתמש, ושומר על פרטיות קוד המקור.
- שני נקודות לכל כלי: מה שהוא עושה, ולמה זאת מתאים לשלב ההוא.
Java: חלקית קומפילציה, חלקית פרשנות
- קוד המקור של Java מתורגם ל-באייטקוד, צורה ביניים צפופה וניידת שאינה קוד מכונה עבור מעבד אמיתי כלשהו.
- מכונה וירטואלית, ה-JVM, מפרשת את הבאייטקוד על כל פלטפורמה עליה היא רצה, או משתמשת ב-קומפילציה בזמן ריצה (JIT) כדי להפוך את החלקים העמוסים ביותר לקוד מקומי בזמן ריצת התוכנית.
- שלב הקומפילציה לוכד שגיאות סינטקס מוקדם; שלב הפרשנות מאפשר לקובץ באייטקוד אחד להריץ בכל מקום בו קיים JVM. Java ב-מצב קונסולה, תוכנת טקסט הנרצית מהשורה הפקודות, היא הדוגמה במסגרת הלימודים.

כתוב פעם אחת, הפעל בכל מקום: קובץ באייטקוד אחד, JVM אחת לפלטפורמה

Java compiles to bytecode that runs on a JVM. The main benefit is:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Bytecode is platform-independent; any JVM can run it (with JIT giving near-native speed for hot code).
Java's compiler produces platform-independent ____, which a virtual machine then interprets.
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Bytecode is an intermediate form: compiled once, then run by the JVM on any platform. That is what makes Java partially compiled and partially interpreted.
הכרטיס הזה תוקן, לכן הוא מוצג באנגלית עד שהתרגום שלו יעודכן.
Worked example: why compile to bytecode and then interpret?
- Explain why Java is compiled to bytecode rather than straight to machine code.
- A compiler produces machine code for a particular processor and operating system, so the program will not necessarily run on a machine with a different platform.
- Java's compiler targets a virtual machine instead, so the bytecode is identical everywhere. Each platform supplies its own JVM to interpret it.
- The cost is speed: interpreting bytecode is slower than running native code, which is why the JVM adds just-in-time compilation 即时编译 for the hot parts.
סביבת הפיתוח המובנית והארבע קבוצות של תכונותיה
- סביבת פיתוח מובנית (IDE) היא יישום אחד לכתיבה, תרגום, הרצה ודיבוג של תוכנית. הסיילבוס מחלק את תכונותיה לארבע קבוצות.
- לכתיבת קוד: הצעות בהקשר מופיעות אוטומטית עם המזהים, המילות המפתח או הפרמטרים המתאימים בנקודה זו; השלמה אוטומטית מסיימת את השם.
- לאיתור שגיאות בתחילה: בדיקות סינטקס דינמיות מדגשות שגיאה בעת הכתיבה, לפני התרגום. לצגה: הדפסה נעימה מציגה מילות מפתח, מזהים, מילים ומערךיות בצבעים שונים עם ריווח עקבי; הרחבה וקיפול מטשטשת גוף של בלוק כדי שתראו את המבנה הכללי.
- לדיבוג: נקודות עצירה משהות את התוכנית בשורה מסומנת; צעד יחיד מריצה שורה אחת בכל פעם; חלון מציג את ערכי המשתנים והביטויים; חלון הדוח מפרט שגיאות, אזהרות ופלט.

כתיבת קוד, איתור שגיאות, הצגה, דיבוג

Which feature is part of an IDE's debugger?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
A debugger lets you set breakpoints, step through code line by line, and inspect variable values.
Match each IDE feature to its syllabus group.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Coding, initial error detection, presentation, debugging: the four groups the syllabus names, one feature each here.
דוגמה מפורטת: מציאת השגיאה ב-Calculate()
- פונקציה
Calculate()מחזירה ערך בלתי צפוי. תיארו כיצד תכונות הדיבוג של IDE עוזרות למצוא את הגורם. [4] - הניחו נקודת עצירה בשורה הראשונה של
Calculate(), כך שהתוכנית תושבת שם במקום להמשיך לרץ. - צעד יחיד דרך הפונקציה שורה אחת בכל פעם. לאחר כל צעד, קראו את ערכי המשתנים וכל ביטוי שביקשתם מ-IDE לעקוב אחריו, והשוו אותם למה שצפיתם.
- השורה הראשונה שלאחריו ערך הוא שגוי היא המקום בו שגיאת הלוגיקה נמצאת. חלון הדוח מציג כל הודעות שגיאת ריצה ופלט לאורך הדרך.

השהיה, צעד, בדיקה

Put the steps of finding a logic error with a debugger in order.
רמת קושי 3/5 · 200 מטבעות + בונוס קטן בהשלמה הראשונה היום
Pause, step, inspect, compare, locate. Each is one of the debugging features the syllabus lists.
סימונים נופלים מהיד
- מחולל אינו מריץ את התוכנית. הוא מתרגם את כולה ומייצר קובץ ניתן לביצוע.
- המתרגם עוצר בשגיאה הראשונה; המהדך מציין את כולן. אל תחליפו בין שני אלו.
- "מהיר יותר" דורש "בעת הרצה", ו"נייד" דורש "אותו מקור רץ בכל מקום בו קיים מתרגם".
- סדרו מאפייני IDE בארבע קבוצות של הסימנאר: נקודת עצירה היא דיבוג, הדפסה מעוצבת היא הצגה, פקודה תלויה בהקשר היא כתיבה. ביטוי בינה (bytecode) הוא לא קוד מכונה.
הבנתך מושלמת
- מתאסם: הוראת אסמבל אחת להוראת קוד מכונה אחת · מהדך: כל התוכנית, לפני ההרצה, קובץ ביצועים, כל השגיאות מצויות · מתרגם: הורהאה אחת בזמן, מתבצעת מיד, עוצר בשגיאה הראשונה, אין קובץ ביצועים
- מהדך למהירות, חלוקה והגנת הסודיות של המקור; מתרגם למחזור עריכה-הרצה מהיר, ניידות ולומדים מתחילים
- Java מהדך לביטוי בינה נייד שאותו JVM מתרגם או JIT-מהדך: חלקית מהודך, חלקית מתרגם
- מאפייני IDE בארבע קבוצות: כתיבה (פקודות תלויות בהקשר), זיהוי שגיאות ראשוני (בדיקות סינטקס דינמי), הצגה (הדפסה מעוצבת, הרחבה וקיפול), דיבוג (נקודות עצירה, צעדים יחידניים, משתנים, חלון דוחות)
מה השתבש? רק צוות האתר רואה זאת.