PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Hwk3 Infinite Loops
Date: Tuesday, 18 Feb 2020, 08:20:23


    > Message Posted By: BC
    >
    > The spec says we have to detect infinite loops ("Detecting infinite loops
    > will be worth at most 6 points."), but I noticed that something like "echo
    > a | /c/cs223/Hwk3/strwrs -r a ab" makes the staff solution go into an
    > infinite loop. Do we have to manage infinite loops that the staff solution
    > does not?

The infinite loops that must be detected are those
described in Note #4:

  Some substitutions (e.g., "strwrs -s a a" applied to "a") would not
  normally terminate.  To make your program more useful, it should detect
  the following such cases:

  a) If the r or s flag has been specified and the replacement of some Fi by
     Ti leaves the line unchanged, then pretend that this rule was not applied
     successfully and continue to the next rule.

  b) If the R flag has been specified and a successful substitution leaves the
     line unchanged, then pretend that the substitution was UNsuccessful and
     continue to the next rule.

--Stan-
PREV INDEX NEXT