Newsgroups: comp.lang.misc Path: utzoo!utgpu!watserv1!tolstoy.waterloo.edu!mhcoffin From: mhcoffin@tolstoy.waterloo.edu (Michael Coffin) Subject: Programs as data Message-ID: <1991Jun28.133708.3776@watserv1.waterloo.edu> Keywords: lisp, prolog Sender: news@watserv1.waterloo.edu Organization: University of Waterloo References: <4671@optima.cs.arizona.edu> Date: Fri, 28 Jun 1991 13:37:08 GMT Lines: 24 It's true that Prolog handles programs-as-data nicely, but I don't think it's true that Prolog has a conventional syntax. Other than using infix notation, it looks nothing like any of the popular languages. That's not surprising; Prolog almost entirely lacks explicit control structures, which are everywhere in conventional languages. And unless you are willing to give up explicit control structures, things are much more difficult than Prolog. You have to devise ways to represent not just infix notation, which has a fairly natural tree representation, but while statements, case statements, for loops, blocks, procedures, exit statements, ---the list goes on. This has in fact been done; I once saw a proposal for a Pascal-like language that allowed programs as data. Each control construct had an internal format that amounted to a record with fields for each piece. Most of the fields, were, of course pointers to other records. The result was, in my opinion, a mess. By the way, I think we ought to keep in mind that there are several Lisps. Common Lisp has a rather complicated syntax, as has been pointed out. Scheme, on the other hand, has a syntax that will fit on a single page and leave room for comments. -mike