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 શીખતી તમારી friend કેમ કહે છે કે એ "ક્યારેય 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 છે. તમારી friend ના Python program માં પણ એ જ lines પર. બંને errors વિશે પહેલાં કોને ખબર પડશે?

  1. તમને: compiler આખી file તપાસીને બંને errors એકસાથે list કરે છે
  2. Friend ને: 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: ઝડપ જોઈએ તો compile, સગવડ જોઈએ તો interpret, લગભગ એટલે જ system software C પર અને ઝટપટ scripts Python પર ટકેલી છે.

Watch out

Marks ક્યાં કપાય છે

એવું લખવું કે editor translate કે run કરે છે: એ text નું tool છે, બસ. Interpreter ને "ઝડપી" કહેવો: એ તરત જેવો LAGE છે (compile step નથી) પણ execute ધીમું કરે છે; બંને ઝડપ અલગ રાખો. અને જ્યારે તમે Turbo C કે VS Code વાપરો છો, તમે એક IDE ની અંદર છો: editor + compiler + runner એક window માં, એક છત, તો પણ exam ના answer માં tools 3 જ.

Theory

તમારું kitchen ગોઠવો

આ જ અઠવાડિયે એક 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