The term S-expression or sexp (S stands for symbolic) refers to a convention for representing semi-structured data in human-readable textual form. S-expressions are probably best known for their use in the Lisp family of programming languages. Lisp (or LISP) is a family of Computer Programming languages with a long history and a distinctive fully parenthesized syntax Other uses of S-expressions are in Lisp-derived languages such as DSSSL, and as mark-up in communications protocols like IMAP and John McCarthy's CBCL. Document Style Semantics and Specification Language ( DSSSL) is a Computer language for specifying stylesheets for SGML documents based on a subset of the The Internet Message Access Protocol or IMAP is one of the two most prevalent Internet standard protocols for E-mail retrieval the other being POP3 John McCarthy (born September 4, 1927, in Boston, Massachusetts) is an American Computer scientist and Cognitive The Common Business Communication Language ( CBCL) is a communications language proposed by John McCarthy that foreshadowed much of XML The details of the syntax and supported data types vary in the different languages, but the most common feature among these languages is the use of S-expressions as parenthesized prefix notation (sometimes known as Cambridge Polish notation). In Linguistics, syntax (from Ancient Greek grc συν- syn-, "together" and grc τάξις táxis, "arrangement" is the Polish notation, also known as prefix notation, is a form of notation for Logic, Arithmetic, and Algebra.
S-expressions are used for both code and data in Lisp (see McCarthy Recursive Functions of Symbolic Expressions [1]). S-expressions were originally intended only for data to be manipulated by M-expressions, but the first implementation of Lisp was an interpreter of S-expression encodings of M-expressions, and Lisp programmers soon became accustomed to using S-expressions for both code and data. In computer programming M-expressions (or meta-expressions) were intended to be the expressions used to write functions in the Lisp programming language.
S-expressions can either be single objects such as numbers, LISP atoms including the special atoms nil and t, or cons pairs, written as (x . Lisp (or LISP) is a family of Computer Programming languages with a long history and a distinctive fully parenthesized syntax In Computer programming, cons (ˈkɒnz or /ˈkɒns/ is a fundamental function in all dialects of the Lisp programming language. y). Longer lists are made up of nested cons pairs, for example (1 . (2 . (3 . nil))) which can also be written more intelligibly as (1 2 3).
Program code can be written in S-expressions, using prefix notation. An extra piece of syntactic sugar for writing Lisp programs is that the common expression (quote x) can be written with the abbreviation 'x. Syntactic sugar is a term coined by Peter J Landin for additions to the Syntax of a Computer language that do not affect its functionality
Example in Common Lisp:
(defun factorial (x) (if (zerop x) 1 (* x (factorial (- x 1)))))
Example in Scheme:
(define (factorial x) (if (zero? x) 1 (* x (factorial (- x 1)))))
In May of 1997, Ron Rivest submitted an Internet-Draft [2] to be considered for publication as an RFC. Common Lisp, commonly abbreviated CL, is a dialect of the Lisp Programming language, published in ANSI standard document Information Scheme is a Multi-paradigm programming language. It is one of the two main dialects of Lisp and supports a number of programming paradigms but is Year 1997 ( MCMXCVII) was a Common year starting on Wednesday (link will display full 1997 Gregorian calendar Ronald Linn Rivest (born 1947, Schenectady, New York) is a cryptographer. Internet Drafts (or I-D s is a series of working documents published by the IETF. In Computer network Engineering, a Request for Comments (RFC is a Memorandum published by the Internet Engineering Task Force (IETF describing The draft defined a syntax based on Lisp S-expressions but intended for general-purpose data storage and exchange (similar to XML) rather than specifically for programming. Don't change "Extensible" It was never approved as an RFC, but it has since been cited and used by other RFCs (e. g. RFC 2693) and several other publications [3]. It was originally intended for use in SPKI. Simple public key infrastructure ( SPKI, pronounced spoo-key) was born out of a joint effort to overcome the overcomplication and scalability problems of traditional
Rivest's format defines an S-expression as being either an octet-string (a series of bytes) or a finite list of other S-expressions. A byte (pronounced "bite" baɪt is the basic unit of measurement of information storage in Computer science. It describes three interchange formats for expressing this structure. One is the "advanced transport", which is very flexible in terms of formatting, and is syntactically similar to Lisp-style expressions, but they are not identical. The advanced transport, for example, allows octet-strings to be represented verbatim (the string's length followed by a colon and the entire raw string), a quoted form allowing escape characters, hexadecimal, Base64, or placed directly as a "token" if it meets certain conditions. In Mathematics and Computer science, hexadecimal (also base -, hexa, or hex) is a Numeral system with a The term Base64 refers to a specific MIME content transfer encoding. (Rivest's tokens differ from Lisp tokens in that the former are just for convenience and aesthetics, and treated exactly like other strings, while the latter have specific syntactical meaning. ) Another interchange format, intended to be more compact, easier to parse, and unique for any abstract S-expression, is the "canonical representation" which only allows verbatim strings, and prohibits whitespace as formatting outside strings. Finally there is the "basic transport representation", which is either the canonical form or the same encoded as Base64 and surrounded by braces, the latter intended to safely transport a canonically-encoded S-expression in a system which might change spacing (e. Brackets are Punctuation marks used in pairs to set apart or interject text within other text g. an email system which has 80-character-wide lines and wraps anything longer than that).
This format has not been widely adapted for use outside of SPKI. Rivest's S-expressions web page provides C source code for a parser and generator, which could theoretically be adapted and embedded into other programs, though licensing on these programs is unclear. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured Copyright is a legal concept enacted by Governments, giving the creator of an original work of authorship Exclusive rights to control its distribution usually for However, there are no restrictions on independently implementing the format. Another implementation can be located here