CGOL - Syntax

Syntax

Special notations are available for many commonly used MACLISP 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 MACLISP's cons function) and the infix @ operation (referring to MACLISP's append function):

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

The preceding example corresponds to this text in native MACLISP:

(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 MACLISP:

(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 MACLISP:

(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.

Read more about this topic:  CGOL

Other articles related to "syntax":

ΛProlog
... higher-order unification gives λProlog the basic supports needed to capture the λ-tree syntax approach to higher-order abstract syntax, an approach to representing syntax that maps ...
Camlp4 - Fields of Application
... If the target language is OCaml, simple syntax add-ons or syntactic sugar can be defined, in order to provide an expressivity which is not easy to achieve using the standard features of the OCaml language ... A syntax extension is defined by a compiled OCaml module, which is passed to the camlp4o executable along with the program to process ... Interestingly, Camlp4 includes a domain-specific language as it provides syntax extensions which ease the development of syntax extensions ...
Py Obj C - Messages and Methods
... The syntax for these message expressions is inherited from Smalltalk, and appears as an object, called the receiver, placed to the left of the name of the message ... arguments are in place, the expression's intent is unambiguous This is distinct from the syntax used in Python, and in many other languages, where an equivalent expression would read myLittleDuck.makeSomeNoise_eye ...
Characteristics of Automatic Speech - Linguistic Features - Syntax
... There are several different types of automatic speech ... One type is relatively universal, often transcending differences in language and to some degree culture ...
Paumarí Language - Syntax
... Two other word orders that occur in Paumarí transitive phrases are OVS and SOV ... In these cases, the object is marked with a suffix denoting it as such (-ra) and is placed directly before the verb ...