Church

Church is a very small statically-typed language that is designed to run on: the Java Virtual Machine, in browsers and natively. It is supported by a compiler that performs source-to-source translation into languages that have direct support on the host platform. It currently only runs on the Java VM, where it translates Church sources to type-safe Java source code. Church's static type system is sound which allows Church programs to be directly translated into efficient native languages like C.

Examples

There is a directory of example code here. The examples reference the Church run-time library, whose sources are here. The corresponding translations to Java source code are available from the "[Java implementation]" link at the top of each HTML rendering of the Church sources.

Specific examples:
The same examples can be downloaded and run locally from the corresponding church-examples project on GitHub. The project has a README.txt file in its root directory which has instructions on how to edit, compile and run the Church sources in the project.

Downloading the SDK

SDK: download.

Influences

Church's primary influences are from:

What's new?

By way of orientation, here are the key differences between Church and:

Overview

Polymorphism in Church

Church's form of polymorphism is based on generic functions, rather than inheritance. Even though this difference seems very fundamental (and it is), Church programs look and work much like Java programs. This is because Church uses similar syntax to Java and uses generic functions to mimic Java's method calling paradigm.

Church unifies the principle of calling a dynamic method with that of making a call to a generic function with an extra parameter. The first translation the Church compiler makes is purely syntactic, along the following lines:

     a.foo(b, c) => foo(a, b, c)

[Kotlin also blurs the distinction between these two syntactic forms.] If the function foo is generic, Church's generic function resolution system will then act at each call-site that references foo, to statically construct an appropriate version of the foo method... [it's easier to understand this by looking at the some of the sample sources: e.g.: ComplexIntegerTest.chuch and its associated ComplexIntegerTest.java translation to Java source code].

Dispatching works on the type of the arguments, not on their run-time class. As Church does not support sub-typing, the need for a formal distinction between type and class is much reduced, though arguably not entirely obviated. In all cases, Church's type system guarantees that there are no cases in which a typing error will occur at run-time.