C++ and Bison

yontanbn

New member
C++ and Bison

Hi all. I´m writing in English because i´m on a computer in the university. You can answer in hebrew. I asked this question in the Linux forum, but I think here is a more suitable place to put it. The deal´s like this, I´m going to write a compiler from a simple prog. language to a simple assembly using Bison. I want to combine c++ code. For instance I already have a tokenizer (lexer) in C++ and i also want to write the symbol table as an STL map or something similar, which will also require C++ code. I undestand there´s something called Bison++ or something similar, for such things, but I don´t wish to use that. What´s the best way to do what I want to do with using the regular bison? Thanks a lot!
 

DarkArcher

New member
Compiler

Hi.. well, since i´m also writing a compiler i think i can help you .. i´m writing a compiter using pure C++ , my comliler will support C language.. ok, first i need to ask what book are you reading ? is it the dragon book for Aho. ?? i can try help ya, i don´t know anything about Bison, but if are intrested just post another message, and we will see... glad to help ya peace!
 

yontanbn

New member
Explanation

Hi DarkArcher and thanks for the reply. I don´t think you understood my intentions... Writing a compiler using a programming language (like pure C++) is something i already did in my past. The goal now is to write a compiler using bison. I´m not using any book, I read the bison manual and that should suffice. All I need is for someone who knows bison, to tell me how I can combine C++ code in it, and not just pure C
 

Zack DA

New member
אז תעשה ככה...

הרי ה- BISON הוא בסך הכל מנתח תחבירי, נכון? תכתוב את הקוד שלך ב- CPP, ואת המנתח התחבירי תיצור בעזרת ה- BISON (כמובן בקבצים שונים, שהרי ה- BISON מאפשר לכתוב בו קוד). ה- BISON יצור לך מהכללים התחביריים שכתבת קובץ C. תוסיף בקובץ ה- CPP שורת INCLUDE לקובץ ה- C שנוצר לך, ואת הכל תבנה בסביבת VISUAL CPP. אם יש בעיות תכתוב, אבל אני מבטיח לך שזה פועל, כבר כתבתי קומפיילרים ככה בעזרת קוד של CPP. צחי
 
למעלה