PINAPL

From Esolang
Jump to navigation Jump to search

PINAPL is an abbrevation for PINAPL Is Not A Programming Language. PINAPL is pronounced like pineapple. It is an attempt at a collaborative effort from many esoteric lunatics. More soon.

Data types

Integers

Data type Size (bits) Description
int 11 A signed one's-complement integer
medium int 23 A signed one's-complement integer
long int 33 A signed one's-complement integer
extra long int 61 A signed one's-complement integer
huge int 1001 A signed one's-complement integer

The corresponding unsigned datatypes are unsigned int, unsigned medium int, unsigned long int , unsigned extra long int and unsigned huge int.

Characters

The data type char represents a character. It is a data type with an underlying data type however the exact underlying data type is undefined.

3VL

The data type tril represents one of three possible values: true, false and maybe.

nil

The data type nil has only one inhabitant: the value nil.

Null

The data type null has the inhabitant 0 (off all integer types), strings of length zero and arrays of length zero. These values may be assignable to a variable of type null. However, a value of type null can only be assigned to variables of type null

The following are thus legal:

   decl x null := ""
   decl x [char] := ""
   decl y null := x

The following are not legal:

  decl x null := "five"
  decl x null := reverse "five"

Union Types

A union type is a type that represents two possible types. For example the union type {int | huge int} represents the two types int and huge int. A union type can be used in places where all of the possible types are accepted. If a function for example has the type medium int -> int then its first argument accepts the types int and medium int. It would thus be legal to pass the union type {int | medium int but not {int | medium int | huge int} or {int | huge int} or {char | int}. A union type can be assigned to a union type if the union type accepts all of the to-be-assigned union types possible types. It is legal to assign the union type {int | char} to the union type {int | char | double} or to {medium int | char}.

Variable Declarations

Variables are declared using decl followed by an optional type followed by the assignment operator := followed by an expression. If an explicit type was specified the assignement operator and expression are optional and the variable is initialized with the type's default value. If no type is specified an assignement operator and expression are mandatory. In such a case the type is inferred from the value.

Expressions

Evaluation Order

The expression a b c X is evaluated by applying c on X, then b on the result of that then a on the result of that.

Example

   fn max(xs Ord:A) A
       return r/ @>. xs
   end