mod_mangle

Last modified Nov. 12, 2007 | Revision 28

A sketchy outline for replacing mod_rewrite with a similar system that is a small functional language. The name is Scott’s idea.

The goal of the language is to be fairly straight forward to port a set of apache mod_rewrite rules to the new system. At the same time, its intended to be more capable of rich transformations and cleaner rules.

Potentially a fun project but currently beyond me in terms of time.

Two fundamental types of rules: functions and regexps. By default these are defined anonymously but can be bound to a name. A regexp’s match groups become function arguments.

Approach: Currently mod_rewrite does the majority of what you would need in terms of a general purpose rewriting engine that is widely available. A simple approach to implement mod_mangle would take a mangle script and compile it down to raw rewrite rules.

A possible implementation would be first to build some lisp/scheme/nu macros to convert an AST (as an S-Exp) into mod_rewrite rules, and then create a parser for actual mangle code that outputs S-Exps.

Some syntax examples

Daleeted because they were silly

Last modified Nov. 12, 2007 | Revision 28