[ann] regexp-engine v0.1 is running

  • Thread starter Simon Strandgaard
  • Start date
S

Simon Strandgaard

I am proud to present version 0.1 of my regexp-engine,
it takes up only 690 lines of Ruby code and can do the most
fundemental operations. In my opinion its good OO.

Please feel free to ask me questions.

download:
http://rubyforge.org/download.php/192/regexp-engine-0.1.tar.gz

this projects RAA entry:
http://raa.ruby-lang.org/list.rhtml?name=regexp

browse CVS:
http://rubyforge.org/cgi-bin/viewcvs/cgi/viewcvs.cgi/projects/regexp_engine/source/?cvsroot=aeditor





Regular Expressions engine, a subproject of AEditor
2003, Copyright by Simon Strandgaard
http://aeditor.rubyforge.org/



About
=====

AEditor needs a regexp engine. You probably think, why not
rely on an existing engine (for instance Ruby's regexp engine) ?
Existing engines are not flexible enough. The iterator pattern
provides that needed flexibility. Thus it should not matter
wheter the engine operate on: UCS-4 or UTF-8 or ASCII.

Goal is to build an engine which is fully compatible with Ruby's
regexp syntax, which can work with iterators.

Eventualy extend the regexp syntax, with some editor-stuff.
For instance: point where cursor should be placed,
match text which is legal ruby code, execute regexp within
retangular selection... etc. I am open to other suggestions.

Eventualy re-implement in C++ to gain performance.


Status
======

Data structure has stabilized and the fundemental operations
are working quite good (was difficult to implement).
Iterators is not yet implemented, thus only ASCII right now.
Performance is not impressive.
Left is all the easy stuff.

* features of the scanner so far:
a|b|c alternation
* repeat(0..infinity) greedy
( ... ) grouping -> register.. nested repeat also works

* features of the parser so far:
( ... ) group -> register
| alternation
\1 .. \9 backreferences
\ escape
. match anything except newline
* repeat(0..infinity) greedy
*? repeat(0..infinity) lazy
+ repeat(1..infinity) greedy
+? repeat(1..infinity) lazy
{n,m} repeat(n..m) greedy constraint(n <= m)
{n,m}? repeat(n..m) lazy constraint(n <= m)
{n,} repeat(n..infinity) greedy
{n,}? repeat(n..infinity) lazy
{m} repeat(m..m) greedy
{m}? repeat(m..m) lazy Does this one make sense ?
specialcase: illegal ranges is treated as they are just
ordinary literals.


License
=======

Ruby's license.


Comments
========

I hope you like it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top