Re: Solution to QOTW #23 in language of QOTW #24

John Macdonald <john-Z7w/En0MP3xWk0Htik3J/[email protected]> Tue, 21 Sep 2004 15:46:06 -0400
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
On Tue, Sep 21, 2004 at 02:28:46PM -0400, Mark Jason Dominus wrote:
> 
> On Sep 21, 2004, at 1:51 PM, Mark Jason Dominus wrote:
> >I think it has fewer
> >states and fewer total instructions,
> 
> I realize now that I could have gotten rid of at least one state and 
> five instructions:
> >
> >C_scan_R [ C_scan_R [ R
> >C_scan_R ] C_scan_R ] R
> >C_scan_R ( C_close [ R
> >C_scan_R ) C_close [ R
> >C_scan_R _ D_fix _ L
> >
> >C_close ( C_open ] R
> >C_close ) C_open ] R
> >
> >C_open ( C_close [ R
> >C_open ) C_close [ R
> >C_open _ D_fix _ L
> 
> C_open is superfluous here; I could re-use C_scan_R instead, like this:
> >
> >C_close ( C_scan_R ] R
> >C_close ) C_scan_R ] R
> 
> and then get rid of C_open and its three instructions entirely.

There've been preprocessors discussed earlier to allow more
convenient forms for writing code for the TM; this suggests that
adding an optimizing postprocessor could also be done.  (That
particular redundant state could be discover automatically,
although others might be harder to recognize.)  Now, let's
just add text processing and we can call it emagccs(TM).

--