翻訳と辞書
Words near each other
・ S-class torpedo boat
・ S-comma
・ S-CRY-ed
・ S-Cup Europe 2008
・ S-Curl
・ S-Curve Records
・ S-DMB
・ S-duality
・ S-duct
・ S-E-X-X-Y
・ S-element
・ S-Endz
・ S-equivalence
・ S-equol
・ S-Ethylisothiouronium diethylphosphate
S-expression
・ S-factor
・ S-Files
・ S-Fone
・ S-form
・ S-formylglutathione hydrolase
・ S-FRAME Software Inc.
・ S-function
・ S-Glutathionylation
・ S-GPS
・ S-graph
・ S-IB
・ S-IC
・ S-II
・ S-III


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

S-expression : ウィキペディア英語版
S-expression

In computing, s-expressions, sexprs or sexps (for "symbolic expression") are a notation for nested list (tree-structured) data, invented for and popularized by the programming language Lisp, which uses them for source code as well as data. In the usual parenthesized syntax of Lisp, an s-expression is classically defined〔John McCarthy (1960/2006). (Recursive functions of symbolic expressions ). Originally published in Communications of the ACM.〕 inductively as
# an atom, or
# an expression of the form (''x'' . ''y'') where ''x'' and ''y'' are s-expressions.
The second, recursive part of the definition represents an ordered pair so that s-exprs are effectively binary trees.
The definition of an atom varies per context; in the original definition by John McCarthy,〔 it was assumed that there existed "an infinite set of distinguishable atomic symbols" represented as "strings of capital Latin letters and digits with single embedded blanks" (i.e., character string and numeric literals). Most modern sexpr notations in addition use an abbreviated notation to represent lists in s-expressions, so that
:(''x'' ''y'' ''z'')
stands for
:(''x'' . (''y'' . (''z'' . NIL)))
where NIL is the special end-of-list symbol (written '() in Scheme).
In the Lisp family of programming languages, s-expressions are used to represent both source code and data. 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. 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 and prefix notation.
==Use in Lisp==
When representing source code in Lisp, the first element of an S-expression is commonly an operator or function name and any remaining elements are treated as arguments. This is called "prefix notation" or "Polish notation". As an example, the Boolean expression written 4 == (2 + 2) in C is represented as (= 4 (+ 2 2)) in Lisp's s-expr-based prefix notation.
As noted above, the precise definition of "atom" varies across LISP-like languages. A quoted string can typically contain anything but a quote, while
an unquoted identifier atom can typically contain anything but quote, whitespace characters, parenthesis, brackets, braces, backslash, and semicolon. In either case, a prohibited character can typically be included by escaping it with a preceding backslash. Unicode support varies.
The recursive case of the s-expr definition is traditionally implemented using cons cells.
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.
This means that Lisp is homoiconic, that is, the primary representation of programs is also a data structure in a primitive type of the language itself.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「S-expression」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.