4 ms·
Lisp has quite a bit more syntax, since it has a two stage syntax. The first stage is a syntax for data, called s-expressions. The parentheses are a part of tha
by lispm 4y ago
Lisp has quite a bit more syntax, since it has a two stage syntax. The first stage is a syntax for data, called s-expressions. The parentheses are a part of that data syntax. Examples for s-expressions:
12
1/3
rome
(rome is a city in italy)
(rome (city . italy) (capital-of italy))
(rome local-name "Roma")
and more. The s-expression syntax is extensible via reader macros.
Lisp programs then are made out of s-expressions and there is a syntax for Lisp. Additionally the Lisp syntax is extensible via macros.
Example:
(let ((a 10)
(b 10))
(declare (integer a b))
(+ a b))
Above is a LET expression for spanning a local lexical scope for variables.
The syntax for LET would be (in some kind of EBNF notation):
let ({var | (var [init-form])}*)
declaration*
form*
With then more syntax for DECLARATION, FORM, ...