Programming languages, translators and IDEs
แนะนำใหม่
8:28
ฮาร์ดแวร์และซอฟต์แวร์
นี่คือคอมพิวเตอร์เครื่องใหม่ ทุกชิ้นส่วนทำงานได้ดี — โปรเซสเซอร์, เมมโมรี่, จอ, คีย์บอร์ด เปิดเครื่องแล้วไม่มีอะไรเกิดขึ้น ไม่มีเดสก์ท็อป…
บรรยายภาษาอังกฤษ · สลับคำบรรยายภาษาอังกฤษและภาษาจีนได้
ในบทเรียนนี้
| English | ความหมาย |
|---|---|
| translator/trænˈsleɪtə/ | โปรแกรมแปลภาษา |
| programs/ˈprəʊɡræmz/ | A set of instructions specifying operations for a computer to carry out. |
| programming language/ˈprəʊɡræmɪŋ ˈlæŋɡwɪdʒ/ | ภาษาการเขียนโปรแกรม |
| CPU/ˌsiː piː ˈjuː/ | |
| machine code/məˈʃiːn kəʊd/ | โค้ดเครื่อง |
| high-level language/haɪ ˈlevl ˈlæŋɡwɪdʒ/ | ภาษาขั้นสูง |
| portable/ˈpɔːtəbl/ | |
| low-level language/ləʊ ˈlevl ˈlæŋɡwɪdʒ/ | ภาษาขั้นต่ำ |
| hardware/ˈhɑːdweə/ | |
| binary/ˈbaɪnəri/ | A number system using base two, with the digits zero and one. |
| assembly language/əˈsemblɪ ˈlæŋɡwɪdʒ/ | ภาษาแอสเซมบลี |
| mnemonics/nɪˈmɒnɪks/ | |
| compiler/kəmˈpaɪlə/ | คอมไพเลอร์ |
| interpreter/ɪnˈtɜːprɪtə/ | อินเทอร์พรีเตอร์ |
| Errors | |
| integrated development environment/ˈɪntɪɡreɪtɪd dɪˈveləpmənt enˈvaɪrənmənt/ | สภาพแวดล้อมในการพัฒนาโปรแกรมแบบบูรณาการ |
| code editor/kəʊd ˈedɪtə/ | A tool for writing and modifying source code, often with features that help identify its structure or mistakes. |
| run-time environment | |
| error diagnostics/ˈerə ˌdaɪəɡˈnɒstɪks/ | |
| auto-completion/correction | |
| prettyprinting/ˈpretɪprɪntɪŋ/ | |
| executable file | |
| source code/sɔːs kəʊd/ |
ภาษาและตัวแปลภาษา
- คนเขียนโปรแกรมใน ภาษาโปรแกรม; CPU ทำงานด้วย รหัสเครื่อง
- ภาษาแบ่งเป็น ระดับสูง หรือ ระดับต่ำ
- ตัวแปลภาษา แปลงโปรแกรมให้เป็นรหัสเครื่อง — และ IDE ช่วยให้คุณเขียนโปรแกรมได้
ห้องปฏิบัติการแนวคิดการคำนวณ
Classify concrete examples by the computing idea they demonstrate.
ระดับสูงเทียบกับระดับต่ำ
- ภาษาระดับสูง (เช่น Python) อ่านเหมือนภาษาอังกฤษ — ง่าย ในการเขียน/แก้ไข และเป็น พกพาได้ (รันบนคอมพิวเตอร์ต่างกันได้)
- ภาษาระดับต่ำ ใกล้เคียงกับฮาร์ดแวร์: (machine code) (binary, รันโดยตรงโดย CPU) และ ภาษาแอสเซมบลี (mnemonics สำหรับ machine code)
- โค้ดระดับต่ำเป็น เฉพาะ CPU — ใช้เมื่อคุณต้องการควบคุมฮาร์ดแวร์เต็มรูปแบบหรือโค้ดที่เร็วมาก เล็กมาก

ภาษา high-level ใกล้เคียงกับภาษามนุษย์และใช้งานข้ามแพลตฟอร์มได้; ภาษา low-level (แอสเซมบลีและ machine code) ใกล้เคียงกับฮาร์ดแวร์และผูกติดกับ CPU เฉพาะตัว

คอมไพเลอร์แปลทั้งโปรแกรมครั้งหนึ่งเป็นรหัสเครื่อง; อินเทอร์โพรเตอร์แปลและรันทีละบรรทัด.

A high-level language (like Python):
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
High-level languages are easy to read/write and portable; low-level languages are CPU-specific.
คอมไพเลอร์เทียบกับอินเทอร์พรีเตอร์
| คอมไพเลอร์ | อินเทอร์พรีเตอร์ | |
|---|---|---|
| แปลงภาษา | ทั้งโปรแกรมพร้อมกัน | บรรทัดต่อบรรทัด |
| ข้อผิดพลาด | รายงานทั้งหมดเมื่อจบ | หยุดที่ข้อผิดพลาดแรก |
| โปรแกรมที่แปลแล้ว | ทำงานเร็ว ไม่ต้องใช้ตัวแปลภาษา | ช้ากว่า ต้องใช้อินเทอร์พรีเตอร์ |
- ใช้ คอมไพเลอร์ เพื่อแชร์โปรแกรมที่แปลแล้วและทำงานเร็ว; ใช้ อินเทอร์พรีเตอร์ ระหว่างการเขียนและทดสอบ

ระบบปฏิบัติการคือซอฟต์แวร์ — โปรแกรมที่สั่งให้ฮาร์ดแวร์ทำงาน

Match each term to what it is.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
High-level → readable; machine code → binary; a compiler translates once, an interpreter goes line by line.
A compiler:
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A compiler translates everything once into a fast stand-alone program; an interpreter goes line by line.
An interpreter translates the whole program once, so it runs fast without the interpreter; a compiler translates line by line.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
False. They are swapped: a compiler translates the whole program once and the result runs without it, while an interpreter translates and runs line by line, stopping at the first error.
สภาพแวดล้อมการพัฒนาแบบบูรณาการ (IDE)
- IDE รวมเครื่องมือสำหรับเขียนโปรแกรมไว้ในที่เดียว:
- code editor, run-time environment, translator, error diagnostics, auto-completion/correction, และ prettyprinting (สีสวยงาม + การจัดรูปแบบช่องว่าง)

ฮาร์ดแวร์คือส่วนประกอบทางกายภาพ; ซอฟต์แวร์คือโปรแกรม

Which is a feature of an IDE?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
An IDE bundles an editor, translator, run-time, diagnostics, auto-complete and prettyprinting.
การ์ดนี้เป็นการ์ดใหม่ จึงแสดงเป็นภาษาอังกฤษจนกว่าคำแปลจะพร้อม
Worked example: choosing a translator
A team is writing a game. While they are developing it they test small changes often; at the end they will sell it to customers. Which translator suits each stage?
- During development: an interpreter. It runs the code line by line straight away and stops at the first error, showing where it is, so each small change can be tested quickly.
- For sale: a compiler. It translates the whole program once into an executable file 可执行文件. Customers run it without needing the translator, it runs fast, and the source code 源代码 stays hidden.
Which translator converts assembly language into machine code?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Each assembly mnemonic maps to one machine-code instruction, which an assembler translates.
A compiler reports all the errors it finds after translating the whole program.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
An interpreter stops at the first error; a compiler gives an error report for the whole program.
คุณเข้าใจแล้ว
- ระดับสูง = คล้ายภาษาอังกฤษ, ย้ายไปใช้กับเครื่องอื่นได้; ระดับต่ำ = โค้ดเครื่อง (ไบนารี) / แอสเซมเบิลี, เฉพาะซีพียู
- ตัวแปลภาษา เปลี่ยนโค้ดให้เป็นโค้ดเครื่อง; คอมไพเลอร์ (ทั้งโปรแกรมพร้อมกัน) เทียบกับ อินเทอร์พรีเตอร์ (บรรทัดต่อบรรทัด)
- คอมไพเลอร์ → โปรแกรมที่แปลแล้วและทำงานเร็ว; อินเทอร์พรีเตอร์ → ทดสอบได้ง่าย
- an IDE bundles editor, translator, diagnostics, auto-complete and prettyprinting
เกิดปัญหาอะไรขึ้น? เฉพาะทีมเว็บไซต์เท่านั้นที่เห็นข้อมูลนี้