A typical whiley program consists of three parts: an abstract syntax tree (AST), a virtual machine (VM), and an interpreter. The syntax tree describes the data types and the syntax of the program, while the interpreter translates these descriptions into code that a runtime environment can understand. The VMs are composed of several programs that run at the same time, and they execute in order on the interpreter machine. The final part is the interpreter itself, which performs all the work required by the programs written for it. A typical whiley program consists of approximately 400 lines of source code, with another fifty lines in the compiler for compilation.
Whiley works on the principle of first-order programs. First-order programs are functions that take as input a series of instructions, which can then be executed on the interpreter machine. First-order programs are useful because they are the building blocks of a variety of other types of programs, and they are often the simplest form of programming languages available to programmers. First-order programs can be expressed in a number of ways. There are first-order programs that can be implemented in machine code, which can then be interpreted by an interpreter machine.
A second-order program can be implemented as an embedded virtual machine. In this case, a virtual machine can execute the program on behalf of the programmer. This is sometimes called “functional programming”parallelism” programming.
Third-order programs are much like first-order programs, except they use an imperative programming paradigm instead of a functional programming paradigm. An imperative programming paradigm is one that defines a type of operation as a sequence of actions and an effect as a single result. In functional programming, on the other hand, a type of operation is defined as a collection of effects. and a single result is defined as a single action.
In an imperative programming paradigm, the programmer defines the set of possible results as an implication of the actions taken, rather than as the result of those actions. In a functional programming paradigm, the programmer defines the set of possible effects as the result of the actions taken. In both cases, the only actions that can be taken are the ones that follow the effect-defined procedure.
In an imperative programming paradigm, there is no need for any information to change the definition of a result before a single action is taken, since each result is defined by the actions. For example, in imperative programming a result, which was previously defined as a value, becomes undefined only when an action is performed that changes the definition of the result. Functional programming, on the other hand, requires the information to change the definition of a result before a single action is taken. This difference between imperative and functional programming is made apparent in a system where two values are defined: a variable x and a result, which are defined as a function.
In an imperative programming paradigm, the only thing that changes the definition of the result is the choice of a function to define the outcome. A functional programming program is more expressive than imperative programming because it does not use a function as a value or a condition. Functional programs allow more control over the effect the program has on the interpreter.