HOME

TheInfoList



OR:

CGOL (pronounced ''"see goll"'') is an alternative syntax featuring an extensible algebraic notation for the
Lisp programming language Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation. Originally specified in the late 1950s, ...
. It was designed for
MACLISP Maclisp (or MACLISP, sometimes styled MacLisp or MacLISP) is a programming language, a dialect of the language Lisp. It originated at the Massachusetts Institute of Technology's (MIT) Project MAC (from which it derived its prefix) in the late 19 ...
by
Vaughan Pratt Vaughan Pratt (born April 12, 1944) is a Professor, Professor Emeritus at Stanford University, who was an early pioneer in the field of computer science. Since 1969, Pratt has made several contributions to foundational areas such as search algorit ...
and subsequently ported to
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
. The notation of CGOL is a traditional
infix notation Infix notation is the notation commonly used in arithmetical and logical formulae and statements. It is characterized by the placement of operators between operands—"infixed operators"—such as the plus sign in . Usage Binary relations are ...
, in the style of
ALGOL ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
, rather than Lisp's traditional, uniformly-parenthesized
prefix notation Polish notation (PN), also known as normal Polish notation (NPN), Łukasiewicz notation, Warsaw notation, Polish prefix notation, Eastern Notation or simply prefix notation, is a mathematical notation in which operators ''precede'' their oper ...
syntax. The CGOL parser is based on Pratt's design for top-down
operator precedence In mathematics and computer programming, the order of operations is a collection of rules that reflect conventions about which operations to perform first in order to evaluate a given mathematical expression. These rules are formalized with a ...
parsing Parsing, syntax analysis, or syntactic analysis is a process of analyzing a String (computer science), string of Symbol (formal), symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal gramm ...
, sometimes informally referred to as a "
Pratt parser In computer science, an operator-precedence parser is a bottom-up parser that interprets an operator-precedence grammar. For example, most calculators use operator-precedence parsers to convert from the human-readable infix notation relying on or ...
". 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 earlier LISP 2 project. Lisp 2 was a successor to LISP 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

Special notations are available for many commonly used Common Lisp operations. For example, one can write a matrix multiply routine as: CGOL has an infix . operation (referring to Common Lisp's cons function) and the infix @ operation (referring to Common Lisp's append function): a.(b@c) = (a.b)@c The preceding example corresponds to this text in native Common Lisp: (EQUAL (CONS A (APPEND B C)) (APPEND (CONS A B) C)) CGOL uses of to read and set properties: The preceding example corresponds to this text in native Common Lisp: (PUTPROP X (GET (GET Y RELATIVE) '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 (X Y) (QUOTIENT 1 (SQRT (PLUS (EXPT X 2) (EXPT Y 2))))) The syntax of CGOL is data-driven and so both modifiable and extensible.


Status and source code

CGOL is known to work on Armed Bear Common Lisp. The CGOL source code and some text files containing discussions of it are available as freeware from
Carnegie-Mellon University Carnegie Mellon University (CMU) is a Private university, private research university in Pittsburgh, Pennsylvania, United States. The institution was established in 1900 by Andrew Carnegie as the Carnegie Technical Schools. In 1912, it became t ...
's Artificial Intelligence Repository.


References

Pratt, Vaughan R. CGOL: An Alternative External Representation for LISP Users. AI Working Paper 121. MIT Artificial Intelligence Laboratory (Cambridge, MA). 1976. Pratt, Vaughan R
CGOL - an Algebraic Notation For MACLISP users.
January 27, 1977.
Pratt, Vaughan R. Top Down Operator Precedence. Proceedings of the ACM Symposium on Principles of Programming Languages. 1973. pp41–51. 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.

''Development of the Armed Bear Common Lisp implementation'' blog.

/ref>
{{DEFAULTSORT:Cgol Lisp programming language family