JPattern

Snobol4-Style Pattern Matching Primitives for Java


Last Updated:01 October 2007
Latest Version:Jpattern 2.0
Minimum JDK Level:JDK 1.5

Table of contents

Introduction

Most current programming languages provide some form of pattern matching. As a rule, the pattern matching is based on regular expressions. The Comit/Snobol3/Snobol4/Spitbol programming languages have provided pattern matching but based on a pattern matching paradigm that is strictly more powerful than standard regular expressions.

The goal of this project is to make Snobol4-style pattern matching available as a package for the Java programming language. Rather than build such a package from scratch, Rober Dewar's existing Ada-based Gnat Spitbol Patterns code was converted to Java. The result is generally consistent with that Ada package, although some changes were made to conform to the capabilities and limitations of the Java language. In light of the derived nature of this code, the original GNAT license is assumed to cover this code. The compiler, however is licensed under a BSD license. See the License Section for more details.

Status

This software should be considered to be in late Alpha stage. Testing has been spotty at best. While the author is not currently using this software, he is supporting it, and bug fixes and extensions are welcome.

Download

Refer to http://www.cs.colorado.edu/~dennis/software for download information.

In addition, earlier versions may also be available through that page.

Note that the jpattern-x.x.jar file is not itself executable by java. It must be downloaded and extracted. An executable jar file (also named jpattern.jar) is included in the set of extracted files.

Dependencies

Installation

The distribution contains both an ant build.xml file and a Makefile. Both have the following major tasks defined. The final product is the jar file called jpattern.jar. For convenience, a version of that jar file is included. It has been compiled with jdk1.5.

Testing

A set of tests is provided in the directory name tests. A make Makefile and an ant build.xml file are both provided.

The output of the tests is captured and compared to the expected output. Any discrepancies are reported.

The set of tests is rather sketchy; it is derived from various examples from online, from the snobol4 book, and from bug reports. If anyone knows of a more comprehensive set of pattern tests, please contact the author.



The JPattern Pseudo-Compiler

The package jpattern.compiler supports the compilation of string expressions into equivalent Pattern objects. It is capable of converting a string representation of a pattern to equivalent Java code (via a command line interface) or to a Pattern object at runtime (via an API). Refer to the reference manual for more details.

Change Log

Changes Incorporated into Version 1

Minor version levels are indicated in parentheses.

Changes Incorporated into Version 2

Minor version levels are indicated in parentheses.



Point of Contact

Author:Dennis Heimbigner
Software Engineering Research Laboratory
Computer Science Department
University of Colorado
Boulder, Colorado 80309-0430 USA
dennis.heimbigner@colorado.edu


License

The code is divided into two parts. The source code which is derived directly from the Ada source code is licensed under that source's license, which is essentially the LGPL. The compiler source code is licensed under the BSD license. See the file license.txt for more more details.