LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   keep symbol table entries uncleared till whole compilation is completed. (https://www.linuxquestions.org/questions/linux-general-1/keep-symbol-table-entries-uncleared-till-whole-compilation-is-completed-4175493792/)

ANUUUU 02-05-2014 07:54 AM

keep symbol table entries uncleared till whole compilation is completed.
 
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?

IT'LL BE VERY HELPFUL IF ANYONE COULD GIVE ME SOME GUIDANCE REGARDING THIS..THANK YOU IN ADVANCE....

sundialsvcs 02-05-2014 05:33 PM

If you use a technique like system(), then you are invoking an entirely separate process to do the work. Therefore, the entire world(!) of that child-process is (of course ...) totally isolated from your own.

If you need to retain information from the compilation, then you'll have to take an entirely different approach: you'll have to maintain (within the context of a single(!) process), a push-down stack of Bison parser contexts, invoking the parser recursively. And, you'll need to engineer strategic points within (the grammar of ...) each context by which the nested contexts can "tell the world about" your shared symbols.

ANUUUU 02-05-2014 11:58 PM

how to switch stack between contexts..
 
Quote:

Originally Posted by sundialsvcs (Post 5112394)
If you use a technique like system(), then you are invoking an entirely separate process to do the work. Therefore, the entire world(!) of that child-process is (of course ...) totally isolated from your own.

If you need to retain information from the compilation, then you'll have to take an entirely different approach: you'll have to maintain (within the context of a single(!) process), a push-down stack of Bison parser contexts, invoking the parser recursively. And, you'll need to engineer strategic points within (the grammar of ...) each context by which the nested contexts can "tell the world about" your shared symbols.

Could you please make it more clear... I didn't completely get what you meant.. Howw to return the stack from one context to another??


All times are GMT -5. The time now is 10:19 AM.