Changes between Version 17 and Version 18 of PIRCDevelopment

Show
Ignore:
Timestamp:
08/06/09 17:24:45 (12 years ago)
Author:
kjs
Comment:

more on heredoc processing. the main function.

Legend:

Unmodified
Added
Removed
Modified
  • PIRCDevelopment

    v17 v18  
    149149For this discussion, it is assumed you have a basic understanding of the Flex program. For instance, you need to know what "state" means in Flex context. If you don't know, please refer to [http://flex.sourceforge.net/manual/ the Flex documentation page]. 
    150150 
    151 In order to make the heredoc preprocessor reentrant, no global variables are used. Instead, lines [source:/trunk/compilers/pirc/src/hdocprep.l#L83 83 to 98] define a struct global_state.  
     151In order to make the heredoc preprocessor reentrant, no global variables are used. Instead, lines [source:/trunk/compilers/pirc/src/hdocprep.l#L83 83 to 98] define a struct global_state. The comments in the code briefly describe what each field is for, but they will be discussed in more detail later if we walk through the actual processing of the heredocs. A new instance of this struct can be created by invoking [source:/trunk/compilers/pirc/src/hdocprep.l#L157 init_global_state]. For now, it is useful to know that this struct has a pointer to a Parrot interpreter object, the name of the file being processed, and a pointer to the output file. 
     152 
     153The function [source:/trunk/compilers/pirc/src/hdocprep.l#L208 process_heredocs] is the main function of the heredoc preprocessor that the main compiler program (PIRC) invokes. This function opens the file to be processed, initializes the lexer, creates a new global_state struct instance, as described above, invokes the lexer to do the processing and cleans up afterwards. 
     154 
    152155 
    153156== Macro layer ==