| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Micmatch

This version was saved 17 years, 11 months ago View current version     Page history
Saved by PBworks
on May 28, 2006 at 1:46:50 pm
 

Micmatch http://martin.jambon.free.fr/micmatch.html is a library which extends OCaml with a convenient syntax for text manipulation using regexps.

 

This is a public discussion board about the use and the development of Micmatch.

 

Upcoming release

 

The latest public release is 0.696. The following things are implemented in the development version:

  • (bug) installation of executables now correctly follows $BINDIR or $PREFIX/bin
  • (+ui) new FILTER macro which returns true or false
  • (+ui) changed grammar entry level of macros (now "expr1" instead of "top"). Allows for less parentheses.
  • (pkg) added dependency to the Unix library
  • (+ui) added filename globbing in the Micmatch library

 

For older changes see http://martin.jambon.free.fr/micmatch-changes.txt

 

Toward Micmatch 1.0

 

The Micmatch project was started in 2004. It's been almost two years, and no major bug has been found. Several features were added since then, but now it seems quite mature.

 

The 1.0 release is planned to include the following features:

  • compatibility with the previous versions
  • a list of deprecated features (which are kept for compatibility purposes)
  • the implementation of the micmatch_pcre macros (SEARCH, MAP, COLLECT, ...) in micmatch_str. Possible warnings concerning undocumented features of Str which are unlikely to change in the future.
  • alternate syntax consisting in putting a given keyword in front of every piece of code using the Micmatch syntax. E.g. the new "match-with" would need to be preceded by "mic" (or another keyword). This keyword could be configurable on the camlp4 command line. This feature is important in order to avoid clashes with other syntax extensions.

 

The idea is to implement these features and then release a 0.99 version first, see if people like it and after a month or so make the 1.0 release.

 

Possible developments

 

General-purpose system for extending pattern-matching

 

Applications would include:

  • matching against lazy values (thus evaluating only what is necessary)
  • regular expressions over arrays or lists
  • views: an alternate symbolic representation of a given type, which does not match the actual representation of the data

 

Issues:

  • completeness checking: the current implementation splits the match cases into several pieces. It prevents the compiler from checking if the cases complete or redundant. It might be possible to introduce unused-but-typechecked code which would make it possible in some cases to check the completeness of the match cases (it would be possible with lazy values match against normal patterns, but not regular expressions).
  • recursivity: in the case of matching lazy values (patterns introduced with "$"), how to do that:

 

match x with
    $(Node (x, $(Node y))) -> ...
  | ...

 

What would a custom extension of pattern-matching consist of?

  • a keyword which identifies the new kind of pattern
  • a macro which tests whether the given value matches the pattern and defines some bindings. If the tests fails, it raises a predefined exception.
  • an indication on how the completeness of the pattern can be checked, if possible. The following are possible:
    • the patterns cannot be converted into a standard OCaml pattern (regular expressions: infinite number of cases which don't cover the whole type)
    • the patterns can be converted into a view, i.e. a valid OCaml type which is not the type of the values that are manipulated (typically, elements which can have different but equivalent physical representations)

 

 

Remarks and suggestions

 

Please put your suggestions here.

Comments (0)

You don't have permission to comment on this page.