Adaptive Framework 0.9.0

Tools and Applications

This section describes the various tools and executables that come with Adaptive Framework.


This is an executable command-line tool that provides an interactive way to access Adaptive expressions, templates and hybrids. It takes the following arguments:

-k, --checkNoneParse but don't evaluate.
-f, --conffilenameSpecifies the configuration file.
-x, --expressionexpressionExpression to evaluate.
-e, --extensionextensionLoad extension.
-h, --helpNonePrint this help and exit successfully.
-p, --parenthesizedNone**DEPRECATED**, use -s p.
-s, --syntaxsyntaxExpression syntax (e|expression, p|parenthesized, t|template, v|hybrid).
-t, --typecontent-typeContent type of the configuration file.

A line ending with "\" will be combined with the line that follows to form one logical line.

When option -s e or -s t is specified, the input is evaluated one logical line at a time.

When option -s p is specified, logical lines are evaluated up to the expression's closing parenthesis (')'). The parenthesized expression can be preceded by any amount of whitespace, including comments, and followed by whitespace up to the end of the line.

When option -s v is specified and the input does not begin with a square bracket ('['), the input must be on one logical line; otherwise, input will be evaluated through the logical line with the hybrid's closing square bracket (']').

The conf option (-f) is used to specify the path to a configuration file. By default, this file should be encoded with a relaxed json syntax, which accepts standard json, plus allows block comments (/* ... */), line comments (//), unquoted property names, and several other conveniences.

The type option (-t) can be used to specify a content type other than the default. If the content type is not part of AFW core, use the extension option (-e) to load the appropriate extension.

If the -f option is not specified, only core AFW functionality is available.

The optional adaptive expression specified by expression option (-x) is evaluated first. If -x is specified and [FILE] is not specified, afw will end after evaluating the expression.

If neither -x or [FILE] is specified, input is read from stdin. Each line read from stdin is evaluated as an adaptive expressions until either a line containing only "exit" or end of file is encountered.

The result of evaluating each expression is converted to a string and written to stdout. If the local option (-l) is not specified, a newline is written after the result.

If the -l option is specified, both input and output must/will be one or more chunks. Each chunk is preceded with a decimal length of the chunk followed by a \n. When errors are written, the length is preceded with a minus sign (-) and the chunk will contain the json representation of the error object. A line containing only 0\n is used to indicate the end of an expression on input and the end of the result or error from the evaluation of the expression on output.

For example, when the -l option is specified, to add 2 plus 2:


The output will be:


The -l option is used by the AFW Python and Perl adaptive function bindings to provide "local" support.


FastCGI is a binary protocol for interfacing interactive programs with a web server. FastCGI was created to provide a more efficient alternative to traditional CGI by reducing overhead. The afwfcgi application is a FCGI (FastCGI) application that starts up and processes FCGI requests. These requests can originate from a FCGI client, or be proxied by a popular web server, such as Apache or Nginx. The afwfcgi executable takes the following command-line arguments:

-ffilenameSpecifies the configuration file to use.
-ppathSpecifies a file path to use for Unix domain socket.
-nthreadsSpecifies the number of threads to startup.
-eextensionLoads an extension prior to starting.
-tcontent-typeSpecifies the content-type to use for the configuration file.
-dlevelSpecifies a debug level.