FALSE

FALSE

:"See False for other meanings of false."FALSE is an esoteric programming language designed by Wouter van Oortmerssen in 1993, named after his favorite Boolean value. It is a small Forth-like stack-oriented language, with syntax designed to make the code inherently obfuscated, confusing, and unreadable. It is also noteworthy for having a compiler of only 1024 bytes (written in 68000 assembly). According to van Oortmerssen, FALSE provided the inspiration for various well known esoteric languages, including brainfuck and Befunge.

FALSE is notably more tractable than most esoteric programming languages. The fundamental operations that it provides are reasonably sensible, and there is no gratuitous complexity. In these respects it stands in stark contrast to the behemoths Intercal and Malbolge. The difficulty of programming in FALSE comes mostly from the low level nature of the language, which has the feel of a Forth-like assembly language. The remainder of the language's awkwardness comes from the concise punctuation-based syntax, which many people find more difficult than a more conventional word-based syntax.

The language features basic arithmetic and logical operations, variables, subroutines as lambda calculus expressions, control flow statements, and input/output operations. FALSE operations are done using a stack. Its structure is largely based on the Forth programming language.

The stack

Everything in the language is defined by how it operates on the stack. When a value is encountered, it is simply pushed onto the stack; when an operator is encountered, a number of operands are popped from the stack, the operation is performed on them, and some number of results are pushed back onto the stack. For example, in the expression 1 3_+: : 1 : pushes the integer 1 onto the stack: 3 : pushes the integer 3 onto the stack: _ : pops 3 from the stack, negates it, and pushes -3: + : pops 1 and -3 from the stack and pushes their sum, -2.
Subroutines also act on the stack - this is the way that they are given arguments and return values; they see the same stack as the rest of the program.

Data types

Data types that can be used in the program are ASCII characters (which are preceded by ' (single-quote)), 32-bit integers, boolean values (0 representing false; -1 representing true), and lambda calculus expressions. These can be used on the stack or stored in variables.

Basic operators

FALSE supports binary and unary operations in reverse Polish notation, as well as operations that act on the stack alone.

Arithmetic operators are +, -, *, and / (binary operators, which pop two elements from the stack and push (respectively) their sum, difference, product, or quotient) and the _ (underscore) is unary negation (which pops one element and pushes its negation).

Logical operators are =, >, &, | (binary operators of equality, greater than, logical conjunction, and logical disjunction), and ~ (unary logical negation).

Stack operators are (with examples of form example inputresulting stack):
*$ - Duplicates the topmost element of the stack: 0 1$0 1 1
*% - Deletes the topmost stack element: 0 1%0
* - Swaps the two topmost stack elements: 0 1 20 2 1
*@ - Rotates the third stack item to the top: 0 1 2 3@0 2 3 1
*ø - Pick: Copies the n-th stack item to the top: 7 8 9 2ø7 8 9 7

Variables

Variables are single lowercase alphabetical characters (a-z). All variables are global. : (colon) sets a variable to the value at the top of the stack (ie, 3a: assigns the value 3 to the variable a) and ; (semicolon) reads their values (ie, a; would push 3 onto the stack if a has been assigned 3). The heavy use of the stack in FALSE eliminates a great deal of need for variables, and they are mainly used with subroutines.

ubroutines

Subroutines are lambda calculus expressions, and are pieces of code contained between [ and ] . The "apply" operator is !. It takes the lambda calculus expression on top of the stack and runs it. Note that if the value on top of the stack is not a lambda expression, the program will behave abnormally.

A very basic example subroutine: 3 [1+] !This pushes 3 on the stack, pushes the expression [1+] (which takes the current stack and increments the top value by 1), and applies this to 3, leaving the stack as 4.

Control flow

FALSE has two control flow statements, if and while.

If

The "if" operator is ?. It takes the two top stack elements, the top being a lambda expression; the second being a boolean, and runs the lambda expression if the boolean is true.

For example, a;1= [3b:] ?tests if the variable a is equal to 1, and if so, runs the expression [3b:] which assigns 3 to b.

While

The "while" operator is #. It takes the top two stack elements, both lambda expressions, and continually evaluates the second element, then the top element, until the second one stops returning true (that is, leaving a true boolean on top of the stack).

For example, [a;1=] [2f;!] #runs the expression [2f;!] (which puts 2 on the stack and runs whatever lambda expression is contained in the variable f) for as long as the variable a is equal to 1.

trings

Strings are not a real data type in FALSE; they only exist as string literals and cannot be stored directly on the stack nor in variables, and cannot be modified. However, they can be contained within lambda expressions (which can be stored). When a string is encountered it is simply printed as output. Strings are any character sequence between double-quotes (""), including newlines. So, a program consisting simply of "Hello world! "would print "Hello world!" followed by a new line.

Lambda expressions can contain strings. For example: a;1= ["true"] ?would print "true" if the variable a is equal to 1.

Input / Output

Apart from strings, which print themselves, FALSE has a number of operators for input/output from and to standard streams.
*. (period) prints the topmost stack item out as an integer.
*, (comma) prints out the topmost stack item as an ASCII character.
*^ reads a single character from standard input and pushes it on the stack.
*ß flushes both standard input and standard output streams.

Comments

Comments are delimited by { and }. Comments cannot be nested.

Code examples

Sample programs taken from the FALSE Programming Language web page:

Hello world: "Hello world! "

File copy utility. Usage: copy <infile >outfile ß [^$1_=~] [,] #

Factorial calculator for numbers 1 through 8: [$1=~ [$1-f;!*] ?] f: { fac() in FALSE } "calculate the factorial of [1..8] : " ß^ß'0-$$0>~8>|$ "result: " ~ [f;!.] ? ["illegal input!"] ?" "

Write all prime numbers up to 100: 99 9 [1-$] [$@$@$@$@/*= [1-$$ [%1-$@] ?0= [$.' ,] ?] ?] #

ee also

*Forth programming language, from which the structure of FALSE was derived.
*Esoteric programming language
*Stack-oriented programming language

External links

* [http://strlen.com/false/false.txt The FALSE Programming Language Manual]
* [http://strlen.com/false/ The FALSE Programming Language Web Page]


Wikimedia Foundation. 2010.

Synonyms:

Look at other dictionaries:

  • False — False, a. [Compar. {Falser}; superl. {Falsest}.] [L. falsus, p. p. of fallere to deceive; cf. OF. faus, fals, F. faux, and AS. fals fraud. See {Fail}, {Fall}.] 1. Uttering falsehood; unveracious; given to deceit; dishnest; as, a false witness.… …   The Collaborative International Dictionary of English

  • false — adj 1: not genuine, authentic, or legitimate compare counterfeit 2 a: not true or correct; esp: intentionally or knowingly untrue or incorrect injured by false accusations b: intended to mislead or deceive: decept …   Law dictionary

  • FALSE — FALSE  эзотерический язык программирования, созданный в 1993 году Wouter van Oortmerssen ом с двумя, по его словам, целями: чтобы можно было написать компилятор для него размером не более одного килобайта. придумать синтаксис, который бы… …   Википедия

  • false — W3S3 [fo:ls US fo:ls] adj ▬▬▬▬▬▬▬ 1¦(untrue)¦ 2¦(wrong)¦ 3¦(not real)¦ 4¦(not sincere)¦ 5 false economy 6 under false pretences 7 false move/step 8 false imprisonment/arrest ▬▬▬▬▬▬▬ [Date: 900 1000; : Latin; …   Dictionary of contemporary English

  • false — adj 1 False, wrong mean not in conformity with what is true or right. False in all of its senses is colored by its original implication of deceit; the implication of deceiving or of being deceived is strong when the term implies a contrariety… …   New Dictionary of Synonyms

  • false — [fôls] adj. falser, falsest [ME < OFr < fals < L falsus, pp. of fallere, to deceive: see FAIL] 1. not true; in error; incorrect; mistaken [a false argument] 2. untruthful; lying; dishonest [a false witness] 3. disloyal; unfaithful [a… …   English World dictionary

  • false — [ fɔls ] adjective ** 1. ) not true: The report was dismissed as totally false. a false statement/claim/accusation ─ opposite TRUE 2. ) made to look like something real: ARTIFICIAL: false eyelashes a ) not real and intended to trick people: a… …   Usage of the words and phrases in modern English

  • false — [fɔːls ǁ fɒːls] adjective 1. not true or real, but intended to look real in order to deceive people: • false and misleading advertisements • Firms issuing false certificates might be subject to lawsuits. 2. a false economy something that you… …   Financial and business terms

  • False — Это статья об утилите Unix. Статья о эзотерическом языке программирования называется FALSE. false (в переводе с английского «ложное») консольная команда UNIX совместимых операционных систем, единственное действие которой возвратить значение 1,… …   Википедия

  • False — is the antonym of the adjective true.False is the 2nd album of Gorefest, False (album).False may also refer to: * FALSE, an esoteric stack oriented programming language * false, a Unix utilityee also* Contradiction * Falsity * Lie * Falsework, a… …   Wikipedia

  • false — fȯls adj, fals·er; fals·est 1) not corresponding to truth or reality <a test for HIV which gave false results> 2) artificially made <false teeth> 3) of a kind related to or resembling another kind that is usu. designated by the… …   Medical dictionary

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”