Working draft, revised 2016-03-16 (UTC+01:00)
Published 2022-02-11T13:24+01:00
This document specifies the OBFL Evaluation Language, a interpreted evaluation language.
This document is a working draft.
This section is informative.
An evaluation language was needed for the formatting process defined by OBFL. The reason being that some decisions have to be made based on the result of the formatting, such as the volume or page number of an element.
An attempt was made at finding an existing language. However, none seemed to suit the specific needs in this context. Either the proposed language contained a vast number of operations that would carry an unclear meaning (such as XPath) or it was too powerful for the situation (full-fledged scripting languages). Others were simply too obscure to be tied to an open standard.
What was needed was simple logical tests and a conditional construct. Hence, the OBFL Evaluation Language was created.
The OBFL Evaluation Language is a simple evaluation language for OBFL.
This section is normative.
The following terms and definitions are used within this document.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
This specification is based on the specific versions of the standards and specifications referenced herein, which are used as defined except as noted in this document. Any refinement or replacement of a referenced specification by a newer or different version is not directly applicable to this standard. Conformance to this standard is based on the versions of the standards and specifications in effect at the time of writing.
This section is normative.
The OBFL Evaluation Language uses prefix notation, i.e. the operator comes first and the arguments follow.
Each operation and its arguments must be surrounded with parenthesis, including the outermost expression.
Arguments are separated by whitespace. An argument can contain whitespace if it is surrounded by quotes.
Variables can be available in a specific evaluation context. Typically,
these variables and their values are supplied to the evaluation engine at the
time of the evaluation of the expression that uses them. A variable be accessed
by its name prefixed by a $. For example, given that a variable with the name
'volume' exists in the evaluation context, it can be used in an expression such
as (= $volume 1)
.
All arithmetic operators require at least two arguments, but accepts an unspecified number of arguments. Each argument is evaluated against the current result.
All comparison operators require at least two arguments, but accepts an unspecified number of arguments. The arguments of comparison operators are processed one at a time evaluating each argument against the previous argument in the list.
All logical operators require at least two arguments, but accepts an unspecified number of arguments.
This section is normative.