WILSON

From Esolang
Jump to navigation Jump to search

WILSON is a symbolic logic processing language written by User:john.ohno in 2009. It is based on a simplified subset form of PROLOG syntax, and is non-Turing-complete, instead correlating directly to formal symbolic logic.

(Contents derived from the WILSON introduction manual)

Description

WILSON is a highly cut-down symbolic logic language with a syntax loosely based on PROLOG. In WILSON, there are no variables – only symbols which are either true or false. Given a dependent relationship between the values of these symbols, WILSON will compute the value of any symbol whose value is unknown.

The syntax for defining a symbol foo is as follows:

foo :- bar, baz, !quux.

This means that foo is true if and only if bar and baz are true and quux is false. Similarly, you can define based on 'or':

foo :- bar, baz; !quux.

This means that foo is true if either both bar and baz are true, or if quux is false. To define foo as always true, the following is useful:

foo.

Syntax

The BNF syntax for WILSON is as follows:

predicate ::= / name ( ':-'  (expr*) )? '.' /
expr ::= / ( ( '!' name) | (name ( ',' | ';' ) ))* ( name ) /
name ::= / ([A-Za-z0-9]+) /

Implementation

The WILSON compiler will generate equivalent source code in FORTH for your expressions, and should check for and notify of most common errors.

To run the WILSON compiler:

cat foo.raw | wilson2forth > foo.fs

The canonical extension for WILSON source files is .raw.

External resources

  • Translator (dead link) written in GNU FLEX that translates WILSON source into GNU FORTH compatible FORTH source code.