Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Syntax  





2 Status and source code  





3 References  














CGOL







Add links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


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 the Lisp programming language. It was designed for MACLISPbyVaughan Pratt and subsequently ported to Common Lisp.[3]

The notation of CGOL is a traditional infix notation, in the style of ALGOL, rather than Lisp's traditional, uniformly-parenthesized prefix notation syntax. The CGOL parser is based on Pratt's design for top-down operator precedence parsing,[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 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[edit]

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

 for i in 1 to n do
   for k in 1 to n do
     (ac := 0;
      for j in 1 to n do
         ac := ac + a(i,j)*b(j,k);
      c(i,k) := ac)

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:

'father' of x := 'brother' of relative of y

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[edit]

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

The CGOL source code and some text files containing discussions of it are available as freeware from Carnegie-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.
  • ^ Pratt, Vaughan R. CGOL - an Algebraic Notation For MACLISP users. January 27, 1977.
  • ^ a b CGOL: Algol-like language that compiles into Common Lisp
  • ^ 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.
  • ^ CGOL on ABCL Development of the Armed Bear Common Lisp implementation blog.

  • Retrieved from "https://en.wikipedia.org/w/index.php?title=CGOL&oldid=1221423482"

    Category: 
    Lisp programming language family
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
     



    This page was last edited on 29 April 2024, at 21:18 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki