Is there a standard approach to implement separate compilation of imported modules with Flex and Bison? In my case, when the parser encounters an identifier in an import declaration it somehow needs to push the current state and start compiling the imported module and then pop the state and proceed compiling the previously pushed module. Any clues?
Is there a standard approach to implement separate compilation of imported modules with Flex
Share
You need to build a reentrant parser and scanner.
Bison has some experimental support for doing this with its ‘pure’ api — you put
%define api.purein the top section of your .y file. Similarly, flex has a%option reentrantyou can use in its first section to build a reentrant scanner. See the bison documentation and flex documentation for more detail.