Nest parsing of two files in fedora core..
I am trying to develop a compiler for a specific language. After generating the parser using bison i tried it with a program(.adb file),say A.adb.Within the compilation of A.adb,I called for compilation of B.ads(using system(./semantizer -dt <B.ads)).It worked.But the problem is: all variables used in B is added to symbol table during its compilation and was erased when it returned to A. I actually wanted all those symbols used in A and B after the compilation of A..What change shall I make to have thi..THANKS IN ADVANCE..
|
if you are using "fedora core"
the VERY LAST ONE was "fedora core 6 " and fedora 6 is 14 versions and 7 YEARS OUT OF DATE so before you do anything install fedora 20 |
how to execute only the grammar rule section of bison file during nested parsing in FC4
Quote:
|
You can't use the system library function to do that. It doesn't share memory with the parent process as the system library function does:
1. forks a new process 2. execs a new executable (usually bash) 3. bash parses the parameter you gave to the system function 4. bash forks a new process... 5. the new bash execs the program identified in the parameter and passes any arguments There is NO WAY that #5 entry can be part of the parent process and no way for it to add symbols to an internal data structure. Now, if you are trying to create an "include file" handling, you must do that within the context of the first bison parser... and do the proper file handling/scanning switching for both scanner AND parser. Since it is now only one process, the symbol tables from the first scanner/parser can be shared with the second scanner/parser. If you are attempting a "two level grammar" that is a different topic... but it is possible to do within a single grammar, though you will need a current Bison parser generator. reference (this points to a lot of information): http://www.gnu.org/software/bison/ |
Quote:
I'm doing a project to develop a compiler in fedoracore4.Bison is used to generate the parser.Language I'm concentrating is more or less similar to ada. The thing is that when another program is refernced from current program,i tried to compile the former from within the compilation of the former using system(command).It worked.But when the control returns, the symbol table entries corresponding to the already compiled program gets cleared.. Is there any way to keep the symbols as such until the whole compilation is completed? the code is: IDENTIFIER_TOK { if(trace)printf("COMPOUND NAME!!\n\n"); if (getcwd(path,sizeof(path))!=NULL) strcat(path,"/"); strcat(path,$1.name); strcat(path,".ads"); fp3=fopen(path,"r+"); if(!fp3) { ReportError(yyline,yycolumn); printf("-------------------------NO SUCH FILE EXIST--%s.ads\n",$1.name); } sprintf(buf,"./semantizer -da <%s.ads",$1.name); system(buf); printf("-----------------CALL RETURNED________________\n\n"); display(); } |
there is no fedoracode4.bison
there is the antique version "bison-2.0-6.i386.rpm " that was in the 8+ year out of date fedora4 ( last updated on 20-May-2005 ) "bison-2.7-3.fc20.i686.rpm" That is in the current version Code:
su - |
Quote:
You need to learn how UNIX/Linux works. http://www.tldp.org/LDP/tlk/tlk-toc.html You also need to learn how to use Bison. Ada is a two level grammar, and Bison can handle it. It isn't simple (two level grammars are never simple), but it is possible. |
All times are GMT -5. The time now is 04:12 AM. |