1 Introduction
The expressibility of functional programming has improved with higherorder programming, letexpression, etc. Nevertheless exception handling could not be dealt with concisely [1]. For this reason, only a few functional languages such as Standard ML support exception handling of the conventional  style.
In this paper, we discard the conventional approach and propose a new, highlevel solution to this problem. A sequentialchoicedisjunctive (SCD) expression, originally introduced in the seminal work of [2], is of the form where are expressions. Evaluating this goal with respect to a program – – has the following intended semantics:
An illustration of this aspect is provided by the following definition of the function where is a list:
The body of the definition above contains a SC expression, denoted by . As a particular example, evaluating would result in selecting and executing the first expression . If the heapsort module is available in the program, then the given goal will succeed, producing solutions. If the execution fails, the machine tries the plan B, i.e., the quicksort module, and so on.
As seen from the example above, SCD expressions of the form can be used to specify an expression , together with the failurehandling routine . Of course, this expression can be generalized to .
2 The Language
The language is a version of the core functional languages – also called primitive recursive functions – with SC expressions. It is described by  and formulas given by the syntax rules below:
In the rules above, is a variable, and is a term which is either a variable or a constant. A formula is called a program.
Following [4, 3], we will present an interpreter for this language as a set of rules. These rules are based on an eager evaluation. Note that execution alternates between two phases: the evaluation phase and the backchaining phase. In the evaluation phase (denoted by ), the machine tries to evaluate an expression from the program to get a value . The rule (6) – (8) are related to this phase. If is a function call , the machine first evaluates all of its arguments and then looks for a definition of in the program in the backchaining mode. This is encoded in the rule (5). In the backchaining mode (denoted by ), the machine tries to evaluate a function call by using the function definition in the program . The rules (1) – (4) describe these operations.
Definition 1. Let be an expression and let be a program. Then the notion of evaluating to a value – – is defined as follows:

if . % switch to evaluation mode. 
if . % look for in 
if . % look for in 
if where . % argument passing to and . 
if . % switch to backchaining. we make a copy of for a function call. 
if and . % evaluate the arguments first. 
% A success if is a constant.

if , provided that is the first successful expression. % exception handling.
In the above rules, only the rule (8) is a novel feature.
3 Examples
As an example, let us consider the wellknown function. There are many different ways to define this function and below is another one.
In the above, let us consider evaluating . Using backchaining, it first tries 4/0. Since it leads to a failure, the system next tries a constant . This leads to a success and the system returns .
4 Conclusion
In this paper, we have considered an extension to functional languages with SCD expressions. This extension allows expressions of the form where are expressions. These expressions are particularly useful for specifying exception handling in a high level way.
References
 [1] R. Govindarajan, “Exception Handlers in Functional Programming ”, IEEE Transactions on Software Engieering, vol.19, No.8, pp.826–834, 1993.
 [2] G. Japaridze, “Sequential operators in computability logic”, Information and Computation, vol.206, No.12, pp.14431475, 2008.

[3]
E. Komendantskaya and V. Komendantsky, “On uniform prooftheoretical operational semantics for logic programming”, In J.Y. Beziau and A.CostaLeite, editors, Perspectives on Universal Logic, pages 379–394. Polimetrica Publisher, 2007.
 [4] D. Miller, “A logical analysis of modules in logic programming”, Journal of Logic Programming, vol.6, pp.79–108, 1989.
Comments
There are no comments yet.