Linisp

Syntax
Login

Strictly speaking Linisp has two pieces of syntax:

  1. Value
  2. Comment

A Linisp program consist entirely of data. However certain types of value follow special rules depending on how they are used.

Because of this program-as-data paradigm this page should be read along side the page Types. It is also recommended that you read the page Functions as most behaviours other languages provide in the syntax are provided via built in functions instead.

Symbols

Symbols are a datatype used to represent variable and function names. Under most circumstances the Linisp interpreter replaces symbols with value of the variables values they are the names of. This default behaviour will feel much like using variables and functions in most other programming languages.

Symbolic-Expressions

(AKA S-Expressions, sexps, or sexprs)

S-Expressions are lists that are treated as function calls and are replaced with their return values. That is to say their first value is the function to be executed and any subsequent values are arguments passed to the function.

The syntax for an S-Expression is either:

( function-symbol )

or

( function-symbol argument-1 argument-2 ... )

Quote-Expressions

(AKA Q-Expressions, lists, qexps, or qexprs)

Q-Expressions are in some ways the more straight-forward list type however symbols placed within a Q-Expression are not substituted for a variable's value. This special rule is used in declaring variables, writing conditional branches and much more.

The syntax for a Q-Expression is:

[ value-1 value-2 ... ]

Comments

Unlike in other Lisp dialects comments are styled after those of Unix shell script and related languages. Comments begin with the # character and continue to the end of the line. For example:

(if (check-password input)
    [define [msg] "Success: Welcome"] #Logged in
    [define [msg] "Error: Try again"] #Wrong password
)

Note that this code snippet demonstrates all of the principles described above.