Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: regexp(ing) Backus-Naurish expressions ... Date: Mon, 11 Mar 2013 21:08:00 +0100 Lines: 47 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net SPtrsz1GeCsGGrtmYWdYKw3CtvRNy+gnX5M9UFa4VsXLvPpZcexX314+w4cy7FBQs= Cancel-Lock: sha1:t+NtaZn36eaJrQZFd7bYOpgEfmY= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 In-Reply-To: X-Antivirus: avast! (VPS 130311-0, 11.03.2013), Outbound message X-Antivirus-Status: Clean Xref: csiph.com comp.lang.java.programmer:22893 On 11.03.2013 00:24, Roedy Green wrote: > On Sun, 10 Mar 2013 22:39:22 +0100, Robert Klemme > wrote, quoted or indirectly quoted > someone who said : > >> What limitations would make me want to write a FSM instead by hand? > > Compacting out nugatory space in HTML would be another example. There are tools for processing tag based languages. Why would I want to create a FSM by hand for that? > Though they are quite complicated, I find FSMs very easy to write, and > they almost always work first time. You can narrow your thinking to a > tiny case and ignore the big picture quite safely. Certainly you can write FSMs for a lot of things. But you were claiming that a manual FSM should be used instead of a regexp engine; so the question remains unanswered: why would anyone create a FSM by hand for parsing? > In contrast, I find my regexes (of any complexity) nearly always have > some unexpected behaviour, often than does not show up immediately. Well, that certainly depends on your familiarity with the tool. To me this sounds suspiciously like NIH syndrome. I am so familiar with using regular expressions of various kinds that it would not occur to me to start writing a FSM for parsing by hand. That is such a waste of time. > The other complicating factor is I use three different regex schemes > in a day: Java, Funduc and SlickEdit. I keep borrowing syntax from > one of the other schemes than the one I am using. And how exactly do you implement a FSM in SlickEdit? > Some day I will > have to write replacements that use Java syntax. Not sure what you mean by that. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/