What is YACC in Hindi – Compiler Design

हेल्लो friends! आज हम इस आर्टिकल में What is YACC in Hindi के बारें में पढेंगे, यह compiler design का एक टॉपिक है तो चलिए शुरू करते हैं:-

YACC in Hindi – compiler design

इसको निम्नलिखित बिन्दुओ के आधार पर आसानी से समझ सकते हैं:-

  • YACC का पूरा नाम Yet Another Compiler Compiler है.
  • यह एक tool है जिसका प्रयोग parser को generate करने के लिए किया जाता है.
  • यह unix ऑपरेटिंग सिस्टम के लिए एक computer program होता है और इसे Stephen C. Johnson ने विकसित किया था.
  • YACC को LALR (1) grammar को compile करने के लिए design किया जाता है.
  • इसका प्रयोग LALR (1) grammar के द्वारा produce की गयी language के syntactic analyzer के source code को produce करने के लिए किया जाता है.
  • YACC का इनपुट rule या grammar है और आउटपुट एक C प्रोग्राम है।

Input file

YACC की इनपुट फाइल में तीन parts होते हैं:-

1:- definition part

  • definition part में syntax definition में प्रयोग किये गये tokens की information सम्मिलित रहती है.
    %token NUMBER
    %token ID
  • YACC tokens को अपने आप ही number assign किया जाता है परन्तु इसे निम्नलिखित के द्वारा override किया जा सकता है:-
    % token NUMBER 621

2:- rule part

  • rule part जो है वह modify किये गये BNF form में grammar definition को contain किये रहता है.

3:- Auxiliary Routines Part:

  • यह part केवल C कोड होता है.
  • इसमें सभी functions के लिए function definitions सम्मिलित रहती है.
  • यह main function को भी contain किये रहता है अगर parser को program की तरह run करने की जरूरत पड़ी तो.
  • main() function को अवश्य ही function yyparse() को call करना चाहिए.

output file:-

  • YACC का आउटपुट tab.c नाम की एक फाइल है.
  • यदि यह main () definition को contain करता है तो इसे execute करने के लिए अवश्य ही compile करना चाहिए.
  • अन्यथा function int yyparse() के लिए कोड external function definition हो सकता है.

इन्हें भी पढ़ें:-

निवेदन:- अगर आपके लिए यह पोस्ट थोड़ी सी भी useful रही हो तो इसे अपने दोस्तों के साथ अवश्य share कीजिये और आपके compiler design से सम्बन्धित कोई सवाल है तो कमेंट के द्वारा बता सकते हैं. thanks.

2 thoughts on “What is YACC in Hindi – Compiler Design”

Leave a Comment