Concepts of Editor, Interpreter and Compiler

Editor वह जगह है जहाँ आप source code लिखते हैं, compiler पूरे program को चलाने से पहले एक साथ translate करता है (C का तरीका), और interpreter line-by-line translate करके चलाता है (Python का तरीका)।

9 min read · 9 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

3 tools, एक confusion

आपका marks program कागज़ पर है। अब practical सवाल: उसे कहाँ type करें? machine code में क्या बदलेगा? और Python सीख रही आपकी दोस्त क्यों कहती है कि वह "कभी compile नहीं करती"?

3 tools इनके जवाब हैं: editor, compiler, interpreter। Students तीनों को मिलाकर एक "coding वाला software" बना देते हैं, और examiners हर साल उसी घालमेल की दावत उड़ाते हैं।

Theory

Notebook, किताब का अनुवादक, live दुभाषिया

Editor एक notebook है: जो लिखो वह रखता है, न कुछ जांचता है, न translate करता है। Compiler किताब का अनुवादक है: आपकी पूरी manuscript लेता है, पूरी translate करता है, और तैयार किताब लौटाता है जिसे कोई भी पूरी रफ्तार से पढ़े। Interpreter वक्ता के बगल वाला live दुभाषिया है: sentence-by-sentence, तुरंत, पर हर बातचीत में उसका होना ज़रूरी, इसलिए कुल मिलाकर धीमा।

At a glance

तीनों tools आमने-सामने

Toolकामउदाहरण
EditorSource text लिखना और edit करनाNotepad, VS Code, Turbo C editor
Compilerपूरा program translate, फिर runC, C++ toolchains
InterpreterLine-by-line translate और runPython, पुरानी BASIC

Theory

Compiler बनाम interpreter: exam वाली तुलना

  • Translation कब होता है: compiler चलने से पहले सब कुछ translate करता है; interpreter चलते समय, line-by-line।
  • Errors का अंदाज़: compiler पूरी file जांचकर सारे errors एक साथ बताता है; interpreter पहली error वाली line पर रुक जाता है।
  • रफ्तार: compiled programs तेज़ चलते हैं (translation की कीमत पहले चुक चुकी); interpreted lines हर run पर translation की कीमत देती हैं।
  • C compiled है। इसीलिए पिछले lesson की pipeline बनी: .c → .obj → .exe।

Quiz

आपके C program में line 5 और 12 पर errors हैं। आपकी दोस्त के Python program में भी उन्हीं lines पर। दोनों errors के बारे में पहले किसे पता चलेगा?

  1. आपको: compiler पूरी file जांचकर दोनों errors एक साथ list करता है
  2. दोस्त को: interpreters errors जल्दी ढूंढते हैं
  3. दोनों को एक साथ दोनों errors दिखेंगे
  4. किसी को नहीं: errors सिर्फ program चलते समय दिखते हैं
Show the answer

आपको: compiler पूरी file जांचकर दोनों errors एक साथ list करता है

Compiler चलने से पहले पूरा source पढ़ता है, इसलिए उसकी error report पूरी file की होती है, line 5 और 12 साथ-साथ। Interpreter line-by-line चलता है और line 5 पर ठप: line 12 की error तब तक छिपी रहती है जब तक 5 ठीक करके दोबारा run न हो। यही scenario compiler-vs-interpreter का classic exam सवाल है।

Think first

सोचकर देखिए

एक weather app हर second लाखों बार भारी calculations करता है। Analogy से reason कीजिए: compiled या interpreted, कौन सा suit करेगा, और क्यों?

Show the answer

Compiled। Translation पहले, एक बार हो चुका, तो run time पर CPU खालिस machine code पूरी रफ्तार से खाता है। Interpreter वही गर्म lines लाखों बार दोबारा translate करता, हर चक्कर पर अनुवादक की फीस। Quote करने लायक rule: speed चाहिए तो compile, सहूलियत चाहिए तो interpret, मोटे तौर पर इसीलिए system software C पर और फटाफट scripts Python पर टिकी हैं।

Watch out

Marks कहाँ कटते हैं

यह लिखना कि editor translate या run करता है: वह text का tool है, बस। Interpreter को "तेज़" कहना: वह तुरंत-सा LAGTA है (compile step नहीं) पर execute धीमा करता है; दोनों रफ्तारें अलग रखिए। और जब आप Turbo C या VS Code use करते हैं, आप एक IDE के अंदर हैं: editor + compiler + runner एक window में, एक छत, फिर भी exam के answer में tools 3 ही।

Theory

अपना kitchen set कीजिए

इसी हफ्ते एक C setup install करके पिछले lesson का marks program compile कीजिए: शुरुआत के लिए कोई भी online C compiler चलेगा, और local IDE (Code::Blocks, VS Code + GCC) असली practice देगा। अपनी ही .c file को .exe बनते देखना 2 lessons एक साथ पक्के कर देता है। आगे: उसी छोटे program की line-by-line anatomy।

Summary

Key takeaways

  • Editor: source text लिखता है; कुछ translate नहीं करता (Notepad, VS Code)।
  • Compiler: चलने से पहले पूरा program translate; सारे errors एक साथ; C का तरीका।
  • Interpreter: line-by-line translate-और-run; पहली error पर रुकता है; Python का तरीका।
  • Compiled programs तेज़ चलते हैं; interpreted में feedback जल्दी मिलता है।
  • IDE एक window में editor + compiler + tools bundle करता है।
  • Memory hook: notebook, किताब का अनुवादक, live दुभाषिया।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Introduction to C language

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

Concepts of Editor, Interpreter and Compiler · Computer Programming and Programming Methodology (CPPM) · Gri-Learn