background preloader

Concepts

Facebook Twitter

The Bisimulation Game Game. The Programming Language Zoo. On this page you will find on display a number of mini languages which demonstrate various techniques in design and implementation of programming languages.

The Programming Language Zoo

The languages are implemented in Objective Caml. The source code is released under the BSD open source license (see accompanying file COPYRIGHT.txt). I teach Theory of Programming Languages (page in Slovene) at the Faculty of Mathematics and Physics of University of Ljubljana. For the course I implemented languages which demonstrate basic concepts such as parsing, type checking, type inference, dynamic types, evaluation strategies, and compilation. My teaching assistants Iztok Kavkler and Matija Pretnar contributed to the source code as well. The languages are not meant to compete in speed or complexity with their bigger cousins from the real world. Visit the PL Zoo discussion at my Mathematics and Computation blog to ask a question or leave a comment. Catamorphism. Higher-order function. Takes one or more functions as an inputoutputs a function In the untyped lambda calculus, all functions are higher-order; in a typed lambda calculus, from which most functional programming languages are derived, higher-order functions are values with types of the form Example[edit] The following examples are not intended to compare and contrast programming languages, since each program performs a different task. def f(x): return x + 3 def twice(function, x): return function(function(x)) print(twice(f, 7)) f = (+3) twice function = function . function main = print (twice f 7)

Higher-order function

List of undecidable problems. Problems in logic[edit] Problems about abstract machines[edit] The mortal matrix problem: determining, given a finite set of n × n matrices with integer entries, whether they can be multiplied in some order, possibly with repetition, to yield the zero matrix.

List of undecidable problems

(This is known undecidable for a set of 7 or more 3 × 3 matrices, or a set of two 21 × 21 matrices.[2])Determining whether a finite set of upper triangular 3 × 3 matrices with nonnegative integer entries generates a free semigroup.Determining whether two finitely generated subsemigroups of Mn(Z) have a common element. Problems in combinatorial group theory[edit] SKI combinator calculus. SKI combinator calculus is a computational system that may be perceived as a reduced version of untyped lambda calculus.

SKI combinator calculus

It can be thought of as a computer programming language, though it is not useful for writing software. Instead, it is important in the mathematical theory of algorithms because it is an extremely simple Turing complete language. All operations in lambda calculus are expressed in SKI as binary trees whose leaves are one of the three symbols S, K, and I (called combinators). In fact, the symbol I is added only for convenience, and just the other two suffice for all of the purposes of the SKI system.

Although the most formal representation of the objects in this system requires binary trees, they are usually represented, for typesetability, as parenthesized expressions, either with all the subtrees parenthesized, or only the right-side children subtrees parenthesized. Informal description[edit] The evaluation operation is defined as follows: I returns its argument: Ix = x Iβα. Interface (computing) In computer science, an interface is a shared boundary across which two separate components of a computer system exchange information.

Interface (computing)

The exchange can be between software, computer hardware, peripheral devices, humans and/or combinations of any two such systems. Some computer interfaces such as a touchscreen can send and receive data, while others such as a mouse, microphone or joystick can only send data.[1] A key principle of design is to prohibit access to all resources by default, allowing access only through well-defined entry points, i.e. interfaces.[3] Such software interfaces provide access to computer resources (such as memory, CPU, storage, etc.) of the underlying computer system.; the direct access (i.e. not through well designed interfaces) to such resources by software can have major ramifications—sometimes disastrous ones—for functionality and stability. Dynamic dispatch. Dynamic dispatch is different from late binding (also known as dynamic binding).

Dynamic dispatch

In the context of selecting an operation, binding associates a name to an operation. Dispatching chooses an implementation for the operation after you have decided which operation a name refers to. With dynamic dispatch, the name may be bound to a polymorphic operation at compile time, but the implementation not be chosen until runtime. However, late binding does imply dynamic dispatching since the binding is what determines the set of available dispatches. With static dispatch, a method call x.foo() will always refer to the implementation of foo() for class A because static binding only looks at the declared type of the object.

Single and multiple dispatch[edit] Dynamic dispatch mechanisms[edit] A language may be implemented with different dynamic dispatch mechanisms. Some languages offer a hybrid approach. C++ implementation[edit] C++ uses early binding and offers both dynamic and static dispatch. Hungarian notation. Hungarian notation was designed to be language-independent, and found its first major use with the BCPL programming language.

Hungarian notation

Because BCPL has no data types other than the machine word, nothing in the language itself helps a programmer remember variables' types. Hungarian notation aims to remedy this by providing the programmer with explicit knowledge of each variable's data type. In Hungarian notation, a variable name starts with a group of lower-case letters which are mnemonics for the type or purpose of that variable, followed by whatever name the programmer has chosen; this last part is sometimes distinguished as the given name.

The first character of the given name can be capitalized to separate it from the type indicators (see also CamelCase). Otherwise the case of this character denotes scope. History[edit] The name Apps Hungarian was coined since the convention was used in the applications division of Microsoft. Systems vs. Relation to sigils[edit]