HOME

TheInfoList



OR:

CGOL (pronounced ''"see goll"'') is an alternative syntax featuring an extensible algebraic notation for the
Lisp programming language Lisp (historically LISP) is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in 1960, Lisp is the second-oldest high-level programming language still in common u ...
. It was designed for MACLISP by
Vaughan Pratt Vaughan Pratt (born April 12, 1944) is a 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 algorithms, sort ...
and subsequently ported to Common Lisp. 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 or simply prefix notation, is a mathematical notation in which operators ''precede'' their operands, in contrast t ...
syntax. The CGOL parser is based on Pratt's design for
top-down Top-down may refer to: Arts and entertainment * " Top Down", a 2007 song by Swizz Beatz * "Top Down", a song by Lil Yachty from ''Lil Boat 3'' * "Top Down", a song by Fifth Harmony from '' Reflection'' Science * Top-down reading, is a part of ...
operator precedence In mathematics and computer programming, the order of operations (or operator precedence) is a collection of rules that reflect conventions about which procedures to perform first in order to evaluate a given mathematical expression. For exam ...
parsing Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term ''parsing'' comes from Lati ...
, 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 LISP 2 was a programming language proposed in the 1960s as the successor to Lisp. It had largely Lisp-like semantics and Algol 60-like syntax. Today it is mostly remembered for its syntax, but in fact it had many features beyond those of early Lisp ...
project. Lisp 2 was a successor to
LISP 1.5 Lisp (historically LISP) is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in 1960, Lisp is the second-oldest high-level programming language still in common ...
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 research university in Pittsburgh, Pennsylvania. One of its predecessors was established in 1900 by Andrew Carnegie as the Carnegie Technical Schools; it became the Carnegie Institute of Technology ...
'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