all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to use parsing expressing grammar
Date: Sun, 21 Dec 2008 10:49:44 +0100	[thread overview]
Message-ID: <m2skohoo1z.fsf@gmail.com> (raw)
In-Reply-To: 91fa65a0-a7e7-4374-8f96-5786c8908615@w24g2000prd.googlegroups.com

* 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 "<img" whitespace (+ attributes whitespace) ">")
>
> 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 "<img" (+ whitespace attribute) (opt whitespace) ">")

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.


  reply	other threads:[~2008-12-21  9:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6b8a1070-1a89-48b0-9287-343b673b5758@a29g2000pra.googlegroups.com>
     [not found] ` <m27i5yygi5.fsf@gmail.com>
     [not found]   ` <m2k59ywtj2.fsf@gmail.com>
     [not found]     ` <b3203a8b-324f-440f-98a9-653c8d582c7c@y1g2000pra.googlegroups.com>
2008-12-20  8:42       ` how to use parsing expressing grammar Xah Lee
2008-12-20  9:34         ` Helmut Eller
2008-12-20 21:41           ` Xah Lee
2008-12-21  9:49             ` Helmut Eller [this message]
2009-03-03 17:34               ` Leo
2009-03-03 17:59                 ` Mike Mattie
     [not found]                 ` <mailman.2299.1236115586.31690.help-gnu-emacs@gnu.org>
2009-03-03 22:05                   ` Xah Lee
2009-03-03 23:52                     ` W Dan Meyer
2009-03-04  0:35                       ` Miles Bader
2009-03-05  6:55                         ` Mike Mattie
2009-03-05  6:18                       ` Mike Mattie
2009-03-05 16:38                     ` Mike Mattie
2009-03-06  8:53                     ` Helmut Eller
2008-12-20 22:27           ` Xah Lee
2008-12-21 11:24             ` Helmut Eller
2008-12-23 23:21         ` ashishnkadakia
2008-12-17 11:53 Xah Lee
2008-12-18  3:43 ` Kevin Rodgers
     [not found] ` <mailman.3007.1229571828.26697.help-gnu-emacs@gnu.org>
2008-12-18  9:24   ` Xah Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2skohoo1z.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.