OBFL Evaluation Language

Working draft, revised 2016-03-16 (UTC+01:00)

Published 2019-07-31T14:01Z

This version:
https://braillespecs.github.io/obfl/obfl-evaluation-language.html
Author:
Joel HÃ¥kansson

Abstract

This document specifies the OBFL Evaluation Language, a interpreted evaluation language.

Status of this Document

This document is a working draft.

Table of Contents

Introduction

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.

What is OBFL Evaluation Language?

The OBFL Evaluation Language is a simple evaluation language for OBFL.

Definitions

This section is normative.

The following terms and definitions are used within this document.

Terminology

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.

Relationship to Other Specifications

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.

Definition of OBFL Evaluation Language

This section is normative.

Syntax

The OBFL Evaluation Language uses prefix notation, i.e. the operator comes first and the arguments follow.

Parenthesis

Each operation and its arguments must be surrounded with parenthesis, including the outermost expression.

Whitespace

Arguments are separated by whitespace. An argument can contain whitespace if it is surrounded by quotes.

Variables

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).

Operators

Arithmetic Operators

All arithmetic operators require at least two arguments, but accepts an unspecified number of arguments. Each argument is evaluated against the current result.

Comparison Operators

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.

Logical Operators

All logical operators require at least two arguments, but accepts an unspecified number of arguments.

Functions

References

Normative References

This section is normative.

[DI Glossary]
"Glossary of Terms for Device Independence", Rhys Lewis, 18 January 2005.
Latest version available at: http://www.w3.org/TR/di-gloss/
[RFC2119]
"RFC2119: Key words for use in RFCs to Indicate Requirement Levels", S. Bradner, March 1997.
Available at: http://www.ietf.org/rfc/rfc2119.txt