3 ms·
That's only the syntax of s-expressions - a data format. The Lisp syntax is defined on top of s-expressions. For example Common Lisp has a CASE operator. That
by lispm 11y ago
That's only the syntax of s-expressions - a data format.
The Lisp syntax is defined on top of s-expressions.
For example Common Lisp has a CASE operator. That's the EBNF syntax:
case keyform {normal-clause}* [otherwise-clause] => result*
normal-clause::= (keys form*)
otherwise-clause::= ({otherwise | t} form*)
An example:
(case id
(10 (foo))
(20 (foo) (bar))
(otherwise (baz)))
The expressions are written using s-expressions as data. But still there is structure in those s-expressions, described by the EBNF syntax of CASE.
Every special operator and every macro provides syntax. Since users can write macros themselves, everybody can extend the syntax. On top of s-expressions.
- greydius 11y agoThat is interesting. I've always considered lisp in terms of denotational semantics. In fact, I wrote a toy lisp in which the complete grammar was basically list -> ({symbol | number | string | list}*) and then it was up to the interpreter to decide the meaning of special forms. (I say "basically" because there was also desugaring of '(...) to (quote ...)).