2009-03-03

emacs, PEG (parsing expression grammar), regex

2009-03-03

On Mar 3, 9:59 am, Mike Mattie wrote:
> On Tue, 03 Mar 2009 17:34:41 +0000
>
> Leo wrote:
> > On 2008-12-21 09:49 +0000, Helmut Eller wrote:
> > >> 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.
>
> > I have seen the project on
> > http://savannah.nongnu.org/projects/emacs-peg. I wonder it might be a
> > good idea to make a newsgroup on gmane to link to the mailing list. It
> > will make more Emacs users subscribe to it.
>
> > Best wishes,
>
> I was working on a PEG/CFG parser compiler: http://www.emacswiki.org/cgi-bin/wiki/ParserCompiler
>
> I will be resuming the development soon. Please keep me in the loop on such efforts.

Folks,

when you create a PEG parser, please please make it user oriented one, so that any user of emacs familiar with regex find-replace will be able to use PEG for find-replace. In particular, when doing find-replace on nested text such as XML.

regex is powerful, but it doesn't do nested text. PEG comes to the rescue. However, it needs to be regex-like, in the sense that the program interface will be a simple source text and replacement text. e.g. a function peg-replace that takes 2 args, pattern text, and text source. The pattern text can be the region, buffer, or a filename, the text source to work on can be similar. (thus, maybe peg-replace-region, peg-replace-buffer, peg-replace-file etc.)

last time i was looking at PEG, i opted to try Helmut Eller's version because it seems simpler. (mike's version is far more compiler geeking incomprehensible) But still problematic to use. I got busy in other things so i didn't continue on studying it, so i dropped out of this thread (havn't read Helmut's last message in detail). Rather, i simply want just to use it. Last in this thread, he mentioned about stacks and i went huh... and just didn't have time to go further.

Regex is practically extremely useful, a tool every programer uses today. However, regex cannot work with nested text such as XML/HTML, which is used extensively, probably more so than any programing lang or text. So, brigining regex power to html/xml will be a major impact on not just emacs, but the whole programing industry. PEG, practically speaking, is basically just the next generation of so-called regex. Emacs can be the first to have such a feature. (existing PEG implementations in various lang, at this point, as far as i know, are all tech geeking toys, done by geekers interested in language parsing and so on.)

Personally, i have huge need for regex that can work on html.
PEG is of course not just a regex replacement, but a BNF replacement in the sense it is actually for machines to read. For these reasons that's how i got heavily interested in PEG. (see:
• Pattern Matching vs Lexical Grammar Specification
http://xahlee.org/cmaci/notation/pattern_matching_vs_pattern_spec.html
)

Please make your PEG in emacs with a regex-like API. Something any emacs user familiar with regex will be able to use brainlessly. This will be huge...

i had plans to open a mailing list and stuff... but got busy with other things. I'll come back to this. But i hope you are convienced about making PEG usable as a text-editing tool, as opposed to a tool for computer scientist or compiler/parser writers.

Also, Mike & Helmut, please consider putting your code in goode code. Google Code is very popular, probably today the most popular code building service, and extremely easy to use, and from my studies Google's products and services are all extremely high quality. It would help a lot in your software at least in the marketing aspect if you use Google Code. Also, open a google group is very useful and popular. (yasnippet is a successful example for a emacs project on google code. There are several others, including e.g. js2, ejacs, the erlang one, etc.) Going into Savana or anything on FSF services tend to be a dead end. (yeah, controversy, but whatever.)

Xah
∑ http://xahlee.org/



http://groups.google.com/group/gnu.emacs.help/msg/a30229e8d6e3d2d8

No comments:

Post a Comment