From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.help Subject: Re: how to use parsing expressing grammar Date: Sun, 21 Dec 2008 10:49:44 +0100 Message-ID: References: <6b8a1070-1a89-48b0-9287-343b673b5758@a29g2000pra.googlegroups.com> <098ddc5b-7074-41fb-a921-caee3bddddff@t39g2000prh.googlegroups.com> <91fa65a0-a7e7-4374-8f96-5786c8908615@w24g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1229864936 12443 80.91.229.12 (21 Dec 2008 13:08:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Dec 2008 13:08:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 21 14:10:03 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LEO4I-00074L-Pm for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Dec 2008 14:10:03 +0100 Original-Received: from localhost ([127.0.0.1]:51680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LEO36-0002Ym-8D for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Dec 2008 08:08:48 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.kpnqwest.it!news.kpnqwest.it.POSTED!not-for-mail Original-NNTP-Posting-Date: Sun, 21 Dec 2008 03:49:50 -0600 Original-Newsgroups: gnu.emacs.help,comp.emacs User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:XPDlivZXbytZrcgisocND/pNpRg= Original-Lines: 52 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 195.254.226.11 Original-X-Trace: sv3-WXwrQoDU3m6/sIaV5mvAP+geTz37fc+CRpqt5A2EnqFl1V12zSE5grrDbL0wRsvYeqDUpE/HTPHjYVm!SkFGVi6Rbojh4EnSvjzK1SvT5vSJ2+lVhEJpGZY+ZpFdK8iUzgf8gB3tQU+RO/U= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Original-Xref: news.stanford.edu gnu.emacs.help:165555 comp.emacs:97507 X-Mailman-Approved-At: Sun, 21 Dec 2008 08:08:27 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60886 Archived-At: * Xah Lee [2008-12-20 22:41+0100] writes: > I have another question, hopefully this one is not a dumb one. > > In summary, if i have > > (imgTag "") > > how to tell PEG that if a attribute is the last item, then the > whitespace following it is optional? Hmm, good question. Perhaps something like (imgTag "") This does a bit of backtracking, but easy to read. >> So far only 2 people asked questions. If there are some more we can set >> up a mailing list. > > I'm pretty sure if you create it, more and more people will join it. > I'm very interested in PEG and think it is of critical importance. I'll try to set up project at savannah. > If say emacs 24 has it built in as C code, with all its regex > functions such as search-forward-regexp, query-replace-regexp etc > having PEG version, it would make emacs a killer app. I don't think that PEGs are easy to use interactively, like query-replace-regexp. Regexps have a more concise notation, which is crucial when used interactively. > From Wikipedia, it appears that people have already wrote PEG lib for > most major langs. There is already a C lib for PEG. The problem with > them is that most comes with a background of computer lang parsing, as > opposed to practical use for text processing like regex. (note: regex > itself came from computer science background as a way to determine > languages with “regular” grammar, but today it is far > removed from theoretical parsing. The process of this transmutation > took i think 10 years, and it took another 10 or so years until it > become a widely popular tool in langs, starting with Perl in the > 1990s) I don't forsee that in the next 10 years that practicing > programers will all know about computer science of parsing or that > major langs will all have formal grammar spec. I'm pretty certain > people are already seeing the potential of PEG as regex replacement > and working towards creatings such practical goal. I think that the Lua language uses PEGs for text processing and apparently implements it's regexp library on top of PEGs. Helmut.