Skip to content
hashmal edited this page Apr 17, 2013 · 3 revisions

Vocabulary: push means "place on the top of the stack" and pull means "remove from the top of the stack".

All values have a type characterising their properties.

List

Arguably the most important type in the language. A list is an ordered sequence of zero or more values (that can be other lists). Values contained in a list do not need to be of the same type (i.e. lists can be heterogenous).

A list begin with [ and end with ]. All values located between these delimiters are the contents of the list. Values do not need to be separated by commas as it is the case in many languages.

Examples

  • []
  • [42 hello]
  • [1 2 3]
  • [ [3.14] foo ]

Execution semantics

The list is pushed without being itself executed.

Symbol

A symbol is a named value. It is mainly used as an identifier to reference a value defined in a different part of a program.

A symbol can begin with any letter (A to Z, a to z) or one of the following characters: ~!@#$%^&*_+-=|\;,.<>?/, followed by zero or more characters of the same set extended with digits (0 to 9). The sequence -- forms the beginning of a comment, thus a symbol cannot use it.

Examples

  • foo
  • +
  • Hello-World

Execution semantics

Look for a reserved value or a defined operation. Push a copy of the value or execute the operation, respectively. If nothing is found, raise an error.

Quoted Symbol

A quoted symbol is similar to a symbol but with different semantics.

A quoted symbol begins with : followed by a symbol.

Examples

  • :foo
  • :+
  • :Hello-World

Execution semantics

Push the quoted symbol.

Boolean

A boolean is either true or false. There isn't any special syntax for booleans: They are created with the operations TRUE and FALSE.

Execution semantics

Push the boolean.

Number

A number represents… well, a number. There is no distinction between integers and floats: They are just numbers.

Examples

  • 42
  • 3.14
  • -1

Execution semantics

Push the number.

Character

A character is signaled by ' followed by the character to represent. Whitespace characters space, tabulation and new-line are represented with \s, \t and \n, respectively. The \ character is represented with \\.

Examples

  • 'a
  • '1
  • \n

Execution semantics

Push the number.

String

A string is not actually a type: It's just a list containing only characters. As a shortcut, a string can be represented with the delimiters ". The " character inside a string is represented with """.

Examples

  • "abc" (equivalent to ['a 'b 'c])
  • "hello world"
  • "\"Nono\""