Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!israel From: israel@umcp-cs.UUCP (Bruce Israel) Newsgroups: net.lang.lisp Subject: Re: BNF for LISP Message-ID: <2289@umcp-cs.UUCP> Date: Thu, 21-Nov-85 02:28:02 EST Article-I.D.: umcp-cs.2289 Posted: Thu Nov 21 02:28:02 1985 Date-Received: Sat, 23-Nov-85 05:20:34 EST References: <771@bu-cs.UUCP> Reply-To: israel@maryland.UUCP (Bruce israel) Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 43 In article <771@bu-cs.UUCP> bzs@bu-cs.UUCP (Barry Shein) writes: > Super >parens (closing off some set of open parens, either all or up to >the last super-open such as "" >or some such are hard I guess. At our site we had this discussion about a lisp BNF a few years ago. At the time I came up with the following non-ambiguous BNF that handles '.'s as well as the '[' & ']' super-parens. S ::= SEXPR S ; lisp is a sequence of s-exprs | ; (possibly empty) SEXPR-list ::= S ; a list of sexprs ... | S SEXPR . SEXPR ; maybe dotted SEXPR ::= '(' SEXPR-list ')' ; sexpr has matching )'s, | '[' SEXPR-list ']' ; or matching ]'s, | ; or none, | '(' S-MINUS-] ')' ; or matching that close off | '[' S-MINUS-) ']' ; one inside, ! S-MINUS-)-1 ']' ; or non-matching that is ! S-MINUS-]-1 ')' ; closed by an unmatched one S-MINUS-] ::= SEXPR-list S-MINUS-]-1 ; can be closed by a ')' ; because its a list of sexprs ; where the last one ends ; without a ']' S-MINUS-) ::= SEXPR-list S-MINUS-)-1 ; ditto S-MINUS-]-1 ::= '[' SEXPR-list ; either the ')' closes one, | '[' S-MINUS-] ; or more than one. S-MINUS-)-1 ::= '(' SEXPR-list ; ditto | '(' S-MINUS-) -- Bruce Israel University of Maryland, Computer Science Dept. {rlgvax,seismo}!umcp-cs!israel (Usenet) israel@Maryland (Arpanet)