Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site uicsl
Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uicsl!segre
From: segre@uicsl.UUCP
Newsgroups: net.lang.lisp
Subject: Re: A BNF for Lisp
Message-ID: <6400002@uicsl>
Date: Mon, 11-Nov-85 10:40:00 EST
Article-I.D.: uicsl.6400002
Posted: Mon Nov 11 10:40:00 1985
Date-Received: Wed, 13-Nov-85 07:24:26 EST
References: <60@aquila.UUCP>
Lines: 57
Nf-ID: #R:aquila.UUCP:60:uicsl:6400002:000:1454
Nf-From: uicsl.UUCP!segre    Nov 11 09:40:00 1985


/* Written 12:10 pm  Nov  7, 1985 by chris@aquila.UUCP in uicsl:net.lang.lisp */
/* ---------- "A BNF for Lisp" ---------- */
A moment of reflection yields the following BNF syntax for
Lisp.

Define a lisp program as a Sexpression, where Sexpression is
given as:

	Sexpression	->	ATOM
			|	( )
			|	( Sexpression . Sexpression )
			|	( Sexpression-List )

	Sexpression-List ->	Sexpression
			|	Sexpression-List Sexpression

		Chris Retterath, Consensys Corp.
		( dciem!aquila!chris )

/* End of text from uicsl:net.lang.lisp */

=============================

Actually, the following is unnecessary:

			|	( Sexpression-List )

since an Sexpression can be ( ) or (Sexpression . Sexpression) you can get
a list of Sexpressions by "CONSing" as follows:

(Sexpression . (Sexpression . (Sexpression ...  . Sexpression ]

where the last Sexpression is ( ).

So it is sufficient to give:

	Sexpression	->	ATOM
			|	( )
			|	( Sexpression . Sexpression )

Of course the syntax given before is also correct, but has some redundant
parts. This "simplified" syntax seems to be more pleasing, since it reflects
the fact that a LISP expression can be an atom, NIL, or a structure of CONSes.


=====

Alberto Segre
Artificial Intelligence Research Group
Department of Electrical and Computer Engineering
Coordinated Science Laboratory
University of Illinois at Urbana-Champaign


ARPA or CSNET:	uicsl!segre@uiuc
UUCP:		...!{ihnp4, convex, pur-ee}!uiucdcs!uicsl!segre