Changes between Version 2 and Version 3 of compiler/nested


Ignore:
Timestamp:
Mar 10, 2010, 4:51:20 PM (9 years ago)
Author:
eamiri
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • compiler/nested

    v2 v3  
    55Consider the following example. When parsing XML files, we need a while loop to find and mask XML comments. Now assume that we have special input using XML syntax, in which the content of XML comments are written a specific language, say CXML. Now assume CXML has its own comments. Now we need to parse the content of XML comments, but we want to mask out CXML comments. One can think of two approaches.
    66
    7 1- First find an XML mask. Then separately parse XML and CXML. One step of CXML parsing is masking out CXML comments. This approach does not need nested loops.
     71- First find an XML comment mask. Then separately parse XML and CXML. One step of CXML parsing is masking out CXML comments. This approach does not need nested loops, but there will be two sequential passes through the input file.
    88
    992- Inside the loop that finds XML comments, nest another loop that finds CXML comments. So when the outer loop is finished by scanning through the input file just once, we have constructed CXML comment mask as well as XML mask. It seems that this approach will lead to higher performance, but there are two complexities to handle. First the compiler should suppport nested loop. Second, the condition of the inner and outer loop might have different forms.