8 ms·
The syntax of S-expressions is the syntax. It's a form to serialize trees (made out of pairs) and it is described by some grammar.
by rusini 7y ago
The syntax of S-expressions is the syntax. It's a form to serialize trees (made out of pairs) and it is described by some grammar.
- lispm 7y ago> The syntax of S-expressions is the syntax. of s-expressions. Lisp has an additional layer of syntax on top of s-expressions. For example the DEFINE-CONDITION operator has this syntax: define-condition name (parent-type*) ({slot-spec}*) option* => name slot-spec::= slot-name | (slot-name slot-option) slot-option::= [[{:reader symbol}* | {:writer function-name}* | {:accessor symbol}* | {:allocation allocation-type} | {:initarg symbol}* | {:initform form} | {:type type-specifier} ]] option::= [[(:default-initargs . initarg-list) | (:documentation string) | (:report report-name) ]] function-name::= {symbol | (setf symbol)} allocation-type::= :instance | :class report-name::= string | symbol | lambda expression with even more syntax for things like lambda expressions and type specifiers.
- rusini 7y agoI know :) And that's cool, and that property is the base of my own programming language. I am also trying right now to find some explanation why it's cool based on some fundamental conclusions from theoretic computer science... I just feel that when someone says that Lisp does not have syntax or that syntax is not important, it's plain wrong...
- lispm 7y ago> I just feel that when someone says that Lisp does not have syntax or that syntax is not important, it's plain wrong... I completely agree. I just feel that not every programming language needs to have the same approach to syntax. Lisp is different from most languages in its way to have a data syntax in which programs are written. Thus the data syntax is textual (s-expressions) and the program syntax is structural (based on data structures like lists, symbols, numbers, ..).
- kazinator 7y agoLet's put it this way: Every function and macro description in the HyperSpec has a "Syntax:" synopsis right at the top. Section 2 of the standard is "Syntax".