Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

CGOL

From Wikipedia, the free encyclopedia
Programming language
This article is about the programming language. For the cellular automaton, seeConway's Game of Life.
CGOL
Paradigmprocedural,imperative,structured
Designed byVaughan Pratt
First appeared1973
Influenced by
ALGOL,FORTRAN,MLisp

CGOL[1][2] (pronounced"see goll") is an alternative syntax featuring an extensible algebraic notation for theLisp programming language. It was designed forMACLISP byVaughan Pratt and subsequently ported toCommon Lisp.[3]

The notation of CGOL is a traditionalinfix notation, in the style ofALGOL, rather than Lisp's traditional, uniformly-parenthesizedprefix notation syntax. The CGOL parser is based on Pratt's design fortop-downoperator precedenceparsing,[4][5] sometimes informally referred to as a "Pratt parser".

Semantically, CGOL is essentially just Common Lisp, with some additional reader and printer support.

CGOL may be regarded as a more successful incarnation of some of the essential ideas behind the earlierLISP 2 project. Lisp 2 was a successor toLISP 1.5 that aimed to provide ALGOL syntax. LISP 2 was abandoned, whereas it is possible to use the CGOL codebase today. This is because unlike LISP 2, CGOL is implemented as portable functions and macros written in Lisp, requiring no alterations to the host Lisp implementation.

Syntax

[edit]

Special notations are available for many commonly used Common Lisp operations. For example, one can write a matrix multiply routine as:

foriin1tondoforkin1tondo(ac:=0;forjin1tondoac:=ac+a(i,j)*b(j,k);c(i,k):=ac)

CGOL has an infix. operation (referring to Common Lisp'scons function) and the infix@ operation (referring to Common Lisp'sappend function):

a.(b@c) = (a.b)@c

The preceding example corresponds to this text in native Common Lisp:

(EQUAL(CONSA(APPENDBC))(APPEND(CONSAB)C))

CGOL usesof to read and set properties:

'father'ofx:='brother'ofrelativeofy

The preceding example corresponds to this text in native Common Lisp:

(PUTPROPX(GET(GETYRELATIVE)'BROTHER)'FATHER)

This illustrates how CGOL notates a function of two arguments:

\x,y; 1/sqrt(x**2 + y**2)

The preceding example corresponds to this text in native Common Lisp:

(LAMBDA(XY)(QUOTIENT1(SQRT(PLUS(EXPTX2)(EXPTY2)))))

The syntax of CGOL is data-driven and so both modifiable and extensible.

Status and source code

[edit]

CGOL is known to work onArmed Bear Common Lisp.[6]

The CGOL source code and some text files containing discussions of it are available as freeware fromCarnegie-Mellon University's Artificial Intelligence Repository.[3]

References

[edit]
  1. ^Pratt, Vaughan R. CGOL: An Alternative External Representation for LISP Users. AI Working Paper 121. MIT Artificial Intelligence Laboratory (Cambridge, MA). 1976.
  2. ^Pratt, Vaughan R.CGOL - an Algebraic Notation For MACLISP users. January 27, 1977.
  3. ^abCGOL: Algol-like language that compiles into Common Lisp
  4. ^Pratt, Vaughan R. Top Down Operator Precedence.Proceedings of the ACM Symposium on Principles of Programming Languages. 1973. pp41–51.
  5. ^Van De Vanter, Michael L.A Formalization and Correctness Proof of the CGOL Language System (Master's Thesis). MIT Laboratory for Computer Science Technical Report MIT-LCS-TR-147 (Cambridge, MA). 1975.
  6. ^CGOL on ABCLDevelopment of the Armed Bear Common Lisp implementation blog.
Retrieved from "https://en.wikipedia.org/w/index.php?title=CGOL&oldid=1328340098"
Category:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp