Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change


by Masem (Monsignor)
on Jan 22, 2001 at 09:18 UTC ( [id://53423]=user: print w/replies, xml ) Need Help??

B.S., Chemical Engineering, U. Toledo, 1993 (Summa Cum Laude)
M.S., Chemical Engineering, U. Michigan, 2000
Ph.D., Chemical Engineering, U. Michigan, 2000
Currently a post-doctorate researcher at Argonne Nat'l Labs in Chicago, IL.
Creator of WS#9 among others...
For those that are curious, I'm mostly self-taught in computer programming; (un)fortunately, the current state of Chemical Engineering tends to value shrink-wrap over innovation...
My Home Page for more details
Sainthood obtained on May 20, 2001 20:20 pm CST.

PerlMonks Other Users Locator

Interested in knowing where the current Other Users are all located? You can now see a map (+/- 10 minutes), and more details on how that's generated are available here.

Perl Puzzles
Posted by the Perplexing Populous of PerlMonks for the Pondering and Pleasure of Prenctices and Professionals of Perl

I'm going to try to keep a current list of perl-based puzzles that have been posted to Perlmonks here; these include but are not limited to Golf or other types of puzzles. If you find me missing one, drop me a msg or a email and I'll add it.


Perl Golf are challenges to produce valid perl code that does a given task in as few characters in the code as possible.

Other Golf Links

Lanugage Puzzlers

Non-Perl Specific Puzzlers

Current 'Projects'
If you want to call these as such...

  • Reworking of WS#9's CGI - most of the current code is hobbled together over 3 years time, and from a feature standpoint, most everything I want is frozen, so I'm working on rewriting everything better thanks to DBI and TT2.
  • Algorithm::Genetic - A generalized framework for running Genetic Algorithms in perl.
  • Game::Life - Runs Conway's Game of Life in perl
  • List 'regex' engine - I'd like to be able to develop a way to be able to match arbitary lists of data against some patterns; the matching would be done at the element level as opposed to individual characters, but I want to be able to include the ability to use arbitary functions for matching as well, such as item for item based on a true string regex, a condition, or other similar features....I want to do this because of ...
  • Rules-based Perl - As discussed in this node, a rules-based perl language would be rather interesting to work with, maybe more from a curiousity sake then anything else. In order to even start this, it's absolutely necessary to develop the list regexs as mentioned above.

Preliminary 'language' for List::Regex

I'd appriciate any comments on this, either to my msg box here or email address and I'll try to post updates here.

I believe I've got the approach to doing this one; I'm going to take Parse::RecDescent, with a fixed grammar, then use that grammar to develop a grammar specifically for the regex itself to pump back into Parse::RecDescent again (meta!). I was going to try to develop my own finite state machine to do this, but I believe I can make use of existing code better than starting from scratch.

Here's the ideas I've had in mind:

  • . - Match any element once
  • /xxxxx - Specific class elements, including
    • /word
    • /number
    • /integer
  • /regex/ - Match element if regex matches element
  • ?variable - Assign one element to $variable
  • ?variable:<any of the above> - Assign $variable with conditions set above
  • ?variable:{ perl code } - Assign $variable, and test the embedded perl code with it.
  • ? - (after element) matches 0 or more times
  • + - (after element) matches 0 or 1 time
  • * - (after element) matches 1 or more times
  • [n,m] - (after element) matches at least n but no more than m times (using {} would be nice if I can set it up to differentiate from the perl code above)
  • <element>|<element> - Or operator
  • (element*)<CODE> - Grouping operator, values stored to @1, @2, etc possibly?  (makes more sense with <code>?variable:(element*))
All matches would be for the entire array, eg implicit ^ and $ on the regex.

Some examples:

@list = qw( The quick brown fox jumped over the lazy dog ); listparse( ".[9]", @list ); #true listparse( ".[8]", @list ); #false listparse( "The ?adjectives:(.*) fox jumped over the lazy ?what", @lis +t ); # $adjectives would be set as a ref to [ quick, brown ] # $what would be set to "fox" listparse( "The ?speed:{ $speed eq 'quick' } .*", @list ); # $speed would be set to 'quick' listparse( "The ?speed:{ $speed ne 'quick' } .*", @list ); # false listparse( "/word*", @list ); #true listparse( "/word /number .*, @list) ; #false
Hopefully that will give some examples of where I'm going with this...

Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-07-16 11:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.