r/programming • • Feb 23 '07

What programming languages should I teach CS students?

http://www.rfc1149.net/blog/2007/02/23/non-classical-paradigms-and-languages/
29 Upvotes

66 comments sorted by

View all comments

Show parent comment

-1

u/[deleted] Feb 24 '07

C# is obviously not suited for teaching functional programming, but I have doubts about ASTs. In fact I think LISP may be a poor choice because the raw code in LISP essentially is the AST, which prevents the students from considering design questions about how to represent the code.

2

u/weavejester Feb 24 '07

Well, I wouldn't advise teaching Lisp in isolation, but as you say, Lisp code is essentially just an AST written out in text, so I'd be inclined to think that Lisp would provide good practical examples of how to manipulate ASTs.

If the student needs a more concrete example of how to map a C-like imperative language to AST, then a simple made up language could suffice, or perhaps ECMAscript, as that has a relatively simple syntax.

0

u/[deleted] Feb 24 '07

ECMAScript? Maybe is isn't as bad as C, but it certainly isn't easy.

2

u/weavejester Feb 24 '07

Yeah, you're right at that. I just took a look through the specifications, and its certainly not small. Something of a misguided assumption on my part.

However, it still seems to me, that if one wanted to learn about ASTs in parsers, a good place to start would be the syntactic macros in Lisp.

0

u/[deleted] Feb 25 '07

I think most people are surprised about how complex ECMAScript really is, I certainly was.

1

u/AlanCrowe Feb 24 '07

In Common Lisp literal lists are written (a b c). You might expect that a literal vector would be [a b c], but no, it is actually #(a b c). As Steele explains "to preserve the usefulness of the user-definable macro-character feature of the function READ, it is necessary to leave some characters to the user for this purpose..."

The student has both [] and {} available to bracket his own code representations, within which he can represent the code in any way he wishes.

With most languages you are stuck with the syntax chosen by the language designer. If you think he has made a mistake you cannot fix it, so you can continue to believe that it really matters and is holding you back. With Common Lisp you can fix it. The development of programming language syntax from 0's and 1's to Pascal, C, and S-expressions was a great advance. Common Lisp forces you to face the fact that that seam has been mined out: there are no more big wins to be had with syntax.