CLIPS Formatting Bundle for TextMate

We used CLIPS, a forward chainingproduction system in some artificial intelligence and cognitive engineering classes as well as Pyps, a sort of Python “CLIPS Light” that the professor Dr. Chris Darken worked up. Since I love TextMate so much, I wanted a more TextMate-like experience, so I worked up a bundle for CLIPS (and Pyps).

Download

Installation

After downloading the zip file above, expand it, and you’ll have a file/bundle called CLIPS (or possible CLIPS.tmbundle if the extension is showing). Move this bundle to your TextMate bundles folder:

You’ll need to create this folder (or folders) if they are not already there.

Quit and restart TextMate.

Usage

You’ll now have CLIPS-specific formatting and a few commands available to you. If your filename ends with .clp or .pyp, TextMate should automatically make the CLIPS bundle the active one. If it does not, you can select CLIPS manually at the bottom of the editor window:

The bundle makes three commands available as well as the nice formatting:

Batch (Cmd-B): Loads the file into the current CLIPS session like CLIPS’ (batch ..) command

Run (Cmd-R): Loads the file (as with Batch) and executes (run) in CLIPS.

Formatting

The following words have special formatting as special language keywords:

defrule

not

or

and

assert

retract

gensym

Rule names (follows defrule) are also formatted specially.

Making it Better

You can extend the CLIPS support yourself with TextMate’s Bundle Editor (that’s how I made this initially). Go to TextMate’s Bundles menu, select Bundle Editor and then Show Bundle Editor.

Learning the TextMate tricks and syntax can be a bit daunting, but just look at other languages for examples. Here’s the editor showing the CLIPS bundle’s language details:

I’ve only used a simple subset of CLIPS, so perhaps you want to add some more keywords to be highlighted. Look for where the string defrule|not|or|and|assert|retract|gensym is above, and you can add run, clear, batch, etc as you like.

The most sophisticated formatting instruction is for the rule names. Here is the instruction I finally figured out:

Related

A number of financial aid programs are offered by the federal government in the form of grants, aids and work-study
programs. One of my favourite examples is “high tension”; in English it is high-voltage
powerlines or a taut rope, in Japanese it’s an excited
person. Another important aspect of studying this field
is that students choose this course to help disadvantaged individuals, groups,
and families through practical assistance, but after completing their study from an online
institute, most of the students fail to interact with disadvantaged people in real life.