Click here to get back home

P~(ptilde) 0.9 released, new scripting language with novel regex

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
P~(ptilde) 0.9 released, new scripting language with novel regex ptilderegex 03-14-2008
Posted by ptilderegex on March 14, 2008, 10:27 am
Please log in for more thread options
P~ (pronounced "ptilde") is a new Java friendly scripting language.
The principle reason for creating it was to offer a new and more
powerful approach to creating regular expressions. Unlike all other
regex engines, P~ does not use the Perl-compatible metacharacter
syntax, instead using algebraic syntax for regex composition. This
decision opens the door to more powerful side-effects than even
possible in Perl, but preserving the readability and maintainability
of P~ regexes. In other regex engines, your regular expressions become
hard to read as the difficulty of the problem increases. Not so in P~.

While P~ makes it easy to grapple with matching and transformation
problems that are hard for even Perl programmers, its basic grammar is
Java-like, more so than even Groovy. This means that Java programmers
can quickly learn the basic grammar forms.

P~ is also Java friendly because you can import Java classes within
your scripts, and use their public apis just like in your Java code.
All you have to do is make sure that when you launch the Ptilde
scripting application, you include the appropriate Java libraries (jar
files) in the classpath.

Finally, P~ is Java friendly because its engine is a Java library.
Thus, if a Java programmer has a tough matching or transformation
problem, solve it first with a P~ script, using the standalone
application shell and the novel P~ regex grammars; then make this
script available to your Java application as either a file or a
resource, and easily invoke it from your Java class. You are allowed
to pass arguments and return a result from a scriptlet.

If this sounds interesting, take a look at the home page for the
documentation, which is found at http://www.ptilde.com. Start with the
Tutorial which will guide you through first the basic grammar of
Ptilde and then through the regex grammar forms.

Posted by Michele Dondi on March 14, 2008, 12:46 pm
Please log in for more thread options
On Fri, 14 Mar 2008 07:27:38 -0700 (PDT), ptilderegex

>Unlike all other
>regex engines, P~ does not use the Perl-compatible metacharacter
^^^
^^^
>syntax, instead using algebraic syntax for regex composition.
[...]
>problems that are hard for even Perl programmers, its basic grammar is
>Java-like, more so than even Groovy. This means that Java programmers
^^^^^^^^^
^^^^^^^^^

So why do you think it may be of interest *here*?!?


Michele
--
->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Posted by brian d foy on March 14, 2008, 6:01 pm
Please log in for more thread options
In article

> This
> decision opens the door to more powerful side-effects than even
> possible in Perl

That's a pretty bold statement considering that Perl can execute
arbitrary code from within a regular expression.


> While P~ makes it easy to grapple with matching and transformation
> problems that are hard for even Perl programmers,

Perhaps you can list a couple of examples. People in this newsgroup
love showing others how easy it is to get things done with regular
expressions. :)


Most of the examples I saw on your website have problems. For instance,
you have a transformation to strip C++ style comments:

function Pattern Comment1 ()
{
return strip("//" + *'[^\r\n]') + eoleof;
}

You fail to distinguish between code and string literals though.
There's an answerin perlfaq6 that addresses this. Your C style comment
stripper is similarly flawed.

In your examples page, you talk about stripping HTML tags, and say that
there isn't an equivalent Perl solution. I guess you missed the one in
perlfaq9.

Although your new language might be nice, don't ignorantly compare it
to any language you don't know. :)

Posted by brian d foy on March 15, 2008, 10:52 am
Please log in for more thread options
In article


> > Perhaps you can list a couple of examples. People in this newsgroup
> > love showing others how easy it is to get things done with regular
> > expressions. :)
>
> A simple example: lets say that in Perl you have a regex but you don't
> know what it is. Its held in a string passed by some function and
> needs to be a parameter. Now, you want to strip everything but what
> matches each time. Or better yet, output what does match to one
> stream, and output what doesn't match to another (in one pass).

It sounds like most of your problem has little to do with regular
expressions and more to do with I/O management.

while( <$fh> )
{
if( m/$regex/ ) { print $out "$`$'"; print $out2 $& }
else { print $out }
}

Posted by ptilderegex on March 16, 2008, 1:10 pm
Please log in for more thread options
> In article
>
> > > Perhaps you can list a couple of examples. People in this newsgroup
> > > love showing others how easy it is to get things done with regular
> > > expressions. :)
>
> > A simple example: lets say that in Perl you have a regex but you don't
> > know what it is. =A0Its held in a string passed by some function and
> > needs to be a parameter. =A0Now, you want to strip everything but what
> > matches each time. =A0Or better yet, output what does match to one
> > stream, and output what doesn't match to another (in one pass).
>
> It sounds like most of your problem has little to do with regular
> expressions and more to do with I/O management.
>
> =A0 =A0while( <$fh> )
> =A0 =A0 =A0 {
> =A0 =A0 =A0 if( m/$regex/ ) { print $out "$`$'"; print $out2 $& }
> =A0 =A0 =A0 else =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ print $out }=

> =A0 =A0 =A0 }

The point of Ptilde is that you can do these complex stream
transformations of any kind at all in one regex pass. What you've got
above is a while loop, not a single regex pass.

Similar ThreadsPosted
ANN: A new scripting language Tao 0.9.0 beta released! April 26, 2005, 9:41 am
Re ANN: A new scripting language Tao 0.9.0 beta released! April 27, 2005, 1:55 am
Re ANN: A new scripting language Tao 0.9.0 beta released! April 27, 2005, 7:49 am
Re ANN: A new scripting language Tao 0.9.0 beta released! April 27, 2005, 9:51 am
Re ANN: A new scripting language Tao 0.9.0 beta released! April 27, 2005, 12:05 pm
Re ANN: A new scripting language Tao 0.9.0 beta released! April 27, 2005, 12:31 pm
Building Hierarchical Class Tree from custom Scripting Language September 9, 2004, 10:05 pm
any tools to enable test automation for scripting language like perl? October 8, 2004, 6:45 am
ANN: Dao 1.0.0-alpha is released June 11, 2006, 12:31 pm
ANN:Just released "The Webmaster Collection" October 3, 2006, 1:21 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap