|
In computer programming, homoiconicity (from the Greek words ''homo'' meaning ''the same'' and ''icon'' meaning ''representation'') is a property of some programming languages in which the program structure is similar to its syntax, and therefore the program's internal representation can be inferred by reading the text's layout.〔(【引用サイトリンク】author=David A. Wheeler )〕 If a language is homoiconic, it means that the language text has the same structure as its abstract syntax tree (i.e. the AST and the syntax are isomorphic). This allows all code in the language to be accessed and transformed as data, using the same representation. In a homoiconic language the primary representation of programs is also a data structure in a primitive type of the language itself. This makes metaprogramming easier than in a language without this property, since code can be treated as data: reflection in the language (examining the program's entities at runtime) depends on a single, homogeneous structure, and it does not have to handle several different structures that would appear in a complex syntax. To put that another way, homoiconicity is where a program's source code is written as a basic data structure that the programming language knows how to access. A typical, commonly cited example is the programming language Lisp, which was created to be easy for lists manipulation and where the structure is given by S-expressions that take the form of nested lists. Lisp programs are written in the form of lists; the result is that the program can access its own functions and procedures while running, and programmatically reprogram itself on the fly. Homoiconic languages typically include full support of syntactic macros allowing the programmer to express program transformations in a concise way. Examples are the programming languages Clojure, which is a contemporary dialect of Lisp, Rebol and Refal. == History == The original source is the paper ''Macro Instruction Extensions of Compiler Languages'',〔Douglas McIlroy (1960) (''Macro Instruction Extensions of Compiler Languages'' )〕 according to the early and influential paper ''TRAC, A Text-Handling Language'':〔Calvin Mooers and L. Peter Deutsch (1965) ''(TRAC, A Text-Handling Language )''〕 Alan Kay used and possibly popularized the term "homoiconic" through his use of the term in his 1969 PhD thesis:〔Alan Kay (1969) (''The Reactive Engine'', PhD thesis ) (Accessed 20061229)〕 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Homoiconicity」の詳細全文を読む スポンサード リンク
|