Flow chart language

Last updated
Flow chart language (FCL)
Paradigm imperative
Designed by Carsten K. Gomard, Neil D. Jones, John Hatcliff
First appeared1989, 1993, 1998

Flow chart language (FCL) is a simple imperative programming language designed for the purposes of explaining fundamental concepts of program analysis and specialization, in particular, partial evaluation. The language was first presented in 1989 by Carsten K. Gomard and Neil D. Jones. [1] It later resurfaced in their book with Peter Sestoft [2] in 1993, and in John Hatcliff's lecture notes [3] in 1998. The below describes FCL as it appeared in John Hatcliff's lecture notes.

Contents

FCL is an imperative programming language close to the way a Von Neumann computer executes a program. A program is executed sequentially by following a sequence of commands, while maintaining an implicit state, i.e. the global memory. FCL has no concept of procedures, but does provide conditional and unconditional jumps. FCL lives up to its name as the abstract call-graph of an FCL program is a straightforward flow chart.

An FCL program takes as input a finite series of named values as parameters, and produces a value as a result.

Syntax

We specify the syntax of FCL using Backus–Naur form.

An FCL program is a list of formal parameter declarations, an entry label, and a sequence of basic blocks:

<p>::= "(" <x>* ")" "(" <l> ")" <b>+ 

Initially, the language only allows non-negative integer variables.

A basic block consists of a label, a list of assignments, and a jump.

<b>::=<l> ":" <a>* <j>

An assignment assigns a variable to an expression. An expression is either a constant, a variable, or application of a built-in n-ary operator:

<a> := <x> ":=" <e><e> := <c> | <x> | <o> "(" <e>* ")" 

Note, variable names occurring throughout the program need not be declared at the top of the program. The variables declared at the top of the program designate arguments to the program.

As values can only be non-negative integers, so can constants. The list of operations in general is irrelevant, so long as they have no side effects, which includes exceptions, e.g. division by 0:

<c>::= "0" | "1" | "2" | ... <o>::= "+" | "-" | "*" | "=" | "<" | ">" | ... 

Where =, <, ... have semantics as in C. The semantics of - is such that if x-y<0, then x-y=0.

Example

We write a program that computes the nth Fibonacci number, for n>2:

(n) (init)  init: x1 = 1       x2 = 1  fib:  x1 = x1 + x2        t = x1       x1 = x2       x2 = t        n = -(n 1)        if >(n 2) then fib else exit  exit: return x2 

Where the loop invariant of fib is that x1 is the (i+2-1)th and x2 is the (i+2)th Fibonacci number, where i is the number of times fib has been jumped to.

We can check the correctness of the method for n=4 by presenting the execution trace of the program:

Where marks a final state of the program, with the return value .

Related Research Articles

In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value is needed and which also avoids repeated evaluations (sharing).

Probability density function Function whose integral over a region describes the probability of an event occurring in that region

In probability theory, a probability density function (PDF), or density of a continuous random variable, is a function whose value at any given sample in the sample space can be interpreted as providing a relative likelihood that the value of the random variable would be close to that sample. In other words, while the absolute likelihood for a continuous random variable to take on any particular value is 0, the value of the PDF at two different samples can be used to infer, in any particular draw of the random variable, how much more likely it is that the random variable would be close to one sample compared to the other sample.

In computing, partial evaluation is a technique for several different types of program optimization by specialization. The most straightforward application is to produce new programs that run faster than the originals while being guaranteed to behave in the same way.

A mathematical symbol is a figure or a combination of figures that is used to represent a mathematical object, an action on mathematical objects, a relation between mathematical objects, or for structuring the other symbols that occur in a formula. As formulas are entirely constituted with symbols of various types, many symbols are needed for expressing all mathematics.

Dynamic programming Problem optimization method

Dynamic programming is both a mathematical optimization method and a computer programming method. The method was developed by Richard Bellman in the 1950s and has found applications in numerous fields, from aerospace engineering to economics.

In mathematics, and in other disciplines involving formal languages, including mathematical logic and computer science, a free variable is a notation (symbol) that specifies places in an expression where substitution may take place and is not a parameter of this or any container expression. Some older books use the terms real variable and apparent variable for free variable and bound variable, respectively. The idea is related to a placeholder, or a wildcard character that stands for an unspecified symbol.

Tangent bundle Tangent spaces of a manifold

In differential geometry, the tangent bundle of a differentiable manifold is a manifold which assembles all the tangent vectors in . As a set, it is given by the disjoint union of the tangent spaces of . That is,

In the calculus of variations and classical mechanics, the Euler–Lagrange equations is a system of second-order ordinary differential equations whose solutions are stationary points of the given action functional. The equations were discovered in the 1750s by Swiss mathematician Leonhard Euler and Italian mathematician Joseph-Louis Lagrange.

Legendre transformation

In mathematics, the Legendre transformation, named after Adrien-Marie Legendre, is an involutive transformation on the real-valued convex functions of one real variable. In physical problems, it is used to convert functions of one quantity into functions of the conjugate quantity. In this way, it is commonly used in classical mechanics to derive the Hamiltonian formalism out of the Lagrangian formalism and in thermodynamics to derive the thermodynamic potentials, as well as in the solution of differential equations of several variables.

Stack-oriented programming, is a programming paradigm which relies on a stack machine model for passing parameters. Stack-oriented languages operate on one or more stacks, each of which may serve a different purpose. Programming constructs in other programming languages need to be modified for use in a stack-oriented system. Some stack-oriented languages operate in postfix or Reverse Polish notation. Any arguments or parameters for a command are stated before that command. For example, postfix notation would be written 2, 3, multiply instead of multiply, 2, 3, or 2 multiply 3. The programming languages Forth, RPL, PostScript, BibTeX style design language and many assembly languages fit this paradigm.

In computer science, corecursion is a type of operation that is dual to recursion. Whereas recursion works analytically, starting on data further from a base case and breaking it down into smaller data and repeating until one reaches a base case, corecursion works synthetically, starting from a base case and building it up, iteratively producing data further removed from a base case. Put simply, corecursive algorithms use the data that they themselves produce, bit by bit, as they become available, and needed, to produce further bits of data. A similar but distinct concept is generative recursion which may lack a definite "direction" inherent in corecursion and recursion.

Irvine Dataflow (Id) is a general-purpose parallel programming language, started at the University of California at Irvine in 1975 by Arvind and K. P. Gostelow. Arvind continued work with Id at MIT into the 1990s.

This article describes the features in Haskell.

Lie point symmetry

Towards the end of the nineteenth century, Sophus Lie introduced the notion of Lie group in order to study the solutions of ordinary differential equations (ODEs). He showed the following main property: the order of an ordinary differential equation can be reduced by one if it is invariant under one-parameter Lie group of point transformations. This observation unified and extended the available integration techniques. Lie devoted the remainder of his mathematical career to developing these continuous groups that have now an impact on many areas of mathematically based sciences. The applications of Lie groups to differential systems were mainly established by Lie and Emmy Noether, and then advocated by Élie Cartan.

Alice ML is a programming language designed by the Programming Systems Laboratory at Saarland University, Saarbrücken, Germany. It is a dialect of Standard ML, augmented with support for lazy evaluation, concurrency and constraint programming.

A Hindley–Milner (HM) type system is a classical type system for the lambda calculus with parametric polymorphism. It is also known as Damas–Milner or Damas–Hindley–Milner. It was first described by J. Roger Hindley and later rediscovered by Robin Milner. Luis Damas contributed a close formal analysis and proof of the method in his PhD thesis.

LOOP is a simple register language that precisely captures the primitive recursive functions. The language is derived from the counter-machine model. Like the counter machines the LOOP language comprises a set of one or more unbounded registers, each of which can hold a single non-negative integer. A few arithmetic instructions operate on the registers. The only control flow instruction is 'LOOP x DO...END'. It causes the instructions within its scope to be repeated x times.

In rewriting, a reduction strategy or rewriting strategy is a relation specifying a rewrite for each object or term, compatible with a given reduction relation. Some authors use the term to refer to an evaluation strategy.

Neil D. Jones

Neil D. Jones is an American computer scientist. He is currently Professor Emeritus in computer science at University of Copenhagen.

Janus is a time-reversible programming language written at Caltech in 1982. The operational semantics of the language were formally specified, together with a program inverter and an invertible self-interpreter, in 2007 by Tetsuo Yokoyama and Robert Glück. A Janus inverter and interpreter is made freely available by the TOPPS research group at DIKU. Another Janus interpreter was implemented in Prolog in 2009. The below summarises the language presented in the 2007 paper.

References

  1. Carsten K. Gomard and Neil D. Jones. Compiler generation by partial evaluation. In G. X. Ritter, editor, Information Processing '89. Proceedings of the IFIP 11th World Computer Congress, pages 1139–1144. IFIP, North-Holland, 1989.
  2. Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. With chapters by L.O. Andersen and T. Mogensen. Prentice Hall International, June 1993. xii + 415 pages. ISBN   0-13-020249-5. Freely available at http://www.itu.dk/~sestoft/pebook/pebook.html
  3. John Hatcliff. An Introduction to Online and Offline Partial Evaluation using a Simple Flowchart Language. In Partial Evaluation - Practice and Theory, DIKU 1998 International Summer School, John Hatcliff, Torben Æ. Mogensen, and Peter Thiemann (Eds.). 1998. Springer-Verlag, London, UK, 20-82.