HELP (Preprocessor)

HELP (Handy Esoteric Language Preprocessor) is a preprocessor created by User:AnotherTest intended to allow faster writing of programs in esoteric programming languages. Its macros are actually regular expressions, allowing the esolang's syntax to be extended. Macros are always applied globally, however the order in which they are defined resembles the order of their application.

Macros that substitute in macros
A macro can create a new macro. HELP will continue until it doesn't find any more directives in the source code.

HELP files
HELP files have the extension .help. Their name is then ext.help, where ext is the extension of the files to which this HELP file may be applied. A HELP file can contain only directives, all other lines will be ignored. They should be used to create a general syntax extension for a specific language.

Future features
Currently, HELP only supports regular-expression based replacements and a limited amount of special directives. The intention is that other features will be added, including:
 * Defining constants with a #define directive
 * Conditionals
 * User-defined initial directive character. '#' is already used in some languages (for example in comments).
 * The ability to undefine unwanted macros (useful in combination with HELP files).

Practical usage
HELP is the standard preprocessor for X.so, where it is used to add C-style and C++-style comments to the language. It also adds a new calling syntax, that is similar to a prefix notation.

Besides that, HELP can also be used to translate Burlesque programs to Underload programs. Similar automated translations may perhaps be another future use of HELP.

Function-like constructs for Burlesque
It is possible to add syntactic constructs to Burlesque using HELP: // For while // For functions fn test: // a function wh 10 .<: ^^        \\/ // we must use a double back-slash because of a technical limitation 1 .+    hw nf test(5) This program will be expanded to: 5 {^^ \/ 1 .+ } {10 .<} w! Which will give the following output: 10 9 8 7 6 5
 * 1) //[^\n]* :=
 * 1) wh\s+(.*?)\s*:\s*(.*?)\s+hw := {\2} {\1} w!
 * 1) fn\s+(.+)\s*:\s*(.*?)\s+nf := #\1\\s*\\((.*?)\\) := \\1\\s\2\\s\n
 * 2) reduce whitespace

Repeat for Burlesque
It is also possible to define a repeat construct. This allows something like the following: rpt 5: ^^    2 .*     \/ tpr vv Which becomes: 0 {^^ 2 .* \/ 1 .+} {5 .<} w! vv The above will output the first 5 even numbers.
 * 1) rpt\s+(.*?)\s*:\s*(.*?)\s+tpr := 0 {\2 1 .+} {\1 .<} w!
 * 2) reduce whitespace

If for Burlesque
If and if-else statements can also be added (with a different syntax): ife 0: 5 else: if 1: 10    fi efi Will become: {5} {{10 } 1 if} 0 ie Which outputs 10, as expected.
 * 1) ife\s+(.*?)\s*:\s*(.*?)\s+else\s*:\s*(.*?)\s+efi := {\2} {\3} \1 ie
 * 2) if\s+(.*?)\s*:\s*(.*?)\s+fi := {\2} \1 if
 * 3) reduce whitespace