W Wrapl, The Programming Language


wrpp is a simple text processor; it copies text from a source file to a destination file processing embedded Wrapl code. Each piece of Wrapl code is escaped with a backslash \ and must contain exactly one expression or declaration. In practice this means that each piece of Wrapl code must end with a semicolon ;. To include a backslash in the output, follow it directly by a semicolon: \;.

All expressions and declarations are evaluated in the same global scope. For example:

1\DEF Bold(text) write('<b>{text}</b>'); 2This is a \Bold("bold"); word.

would produce the following output:

This is a <b>bold</b> word.

Predefined Identifiers

A number of identifiers are predefined while wrpp processes Wrapl code.

stackThe output stream stack. This is a list of IO.Stream.T objects.
push(buffer)Pushes buffer onto stack. If buffer is omitted a new instance of IO.Buffer.T is used.
pop()Pops the last stream pushed onto stack and returns it.
beginA Std.Symbol.T useful for implementing begin/end environments.
endA Std.Symbol.T useful for implementing begin/end environments.
buffer()Returns a new IO.Buffer.T.
include(filename)Processes input from filename.
_include_(filename)Same as include(filename) but empty lines are not copied to the output.
write(text)Writes text to the current output stream (i.e. stack[1]).
definesA table which contains all -Did=value options passed on the command line. The contents of defines may be modified.
includesA list of directories to search for files in include(). May be modified.
escapeThe current character used to escape Wrapl code. May be modified, but should only ever be set to a single character.

Command Line Options

The basic invocation for wrpp is wrpp [options] <filename>. If is omitted, input is read from stdin. The following options are currently supported:

-D id=valueAdds the (key, value) pair (id, value) to defines. The =value may be omitted, in which case id is used value.
-o filenameWrites the output to filename. If no -o option is present, output is written to stdout.
-I directoryAdds directory to includes for searching for included files.
-L directoryAdds directory to the module search path for riva.
-p filenamePreincludes filename before reading the source file. Uses include to include the file.
-P filenamePreincludes filename before reading the source file. Uses _include_ to include the file.