I gave a talk yesterday on implementing a VM in 30 minutes. I'm not sure how well it went (it's a lot of material for 30 minutes), but I hope I at least got some people excited about implementing languages.
I told my 2nd year CS students to create a programming language
61–67 of 67 posts
Re: I told my 2nd year CS students to create a programming language
#62Earlier quoted context omitted.
That's jaw-dropping really... every student should have to experience the horrors of the dragon book. *edit: I say that firmly tongue in cheek. The Dragon book is one of the most important pieces of CS literature ever written. It's a fine book, the subject matter is just difficult:)
The Dragon book may be a fine book but it is mainly a book on parsing, not on compilers. You first learn about control flow graphs in chapter 9! Most courses probably won't even get that far. The parts that are about compilation are very old fashioned, essentially a book about "how to compile Fortran to inefficient code like they did in the '60ies". It would be great if there was a book on modern compiler techniques,…
http://store.elsevier.com/product.jsp?isbn=9780120884780
Two of the most important books I own.
Also, thank you for tearing down the dragon book -- I was going to do the same myself.
The dragon book is outdated on parsing, too. It's from a time where single-pass parsing and compilation was sometimes necessary because you didn't have enough memory (or time) to do multiple passes. It certainly doesn't have anything on packrat parsing. It is a historical book -- I would recommend it for no serious purpose (even pedagogical) these days.
Re: I told my 2nd year CS students to create a programming language
#63It's a neat idea, but I really want to hear an experience report on the results . I don't want to throw cold water on this, because I want it to work and I think it might, but I have a fair amount of experience here[0] and can think of a number of reasons why it might go poorly as well. All we see in the OP is, "here's an idea that's cool (and it is) and I'm optimistic that it will work." [0]I have taught courses whe…
I will share the results on a future post. I understand your point, but I think the assignment will enhance their skills related to objects, classes, methods and instantiation. That's my goal, not teaching about compilers or language structure. About that they will learn empirically.
Re: I told my 2nd year CS students to create a programming language
#64I wish I had a professor like you. When I asked why there was no compiler class, the answer I was given was: "compilers are a solved problem; there's no point in teaching them anymore." Maybe it's just my school though.
Which school do you go to? Compilers seems like a pretty standard CS course at most schools.
Re: I told my 2nd year CS students to create a programming language
#65Earlier quoted context omitted.
I will share the results on a future post. I understand your point, but I think the assignment will enhance their skills related to objects, classes, methods and instantiation. That's my goal, not teaching about compilers or language structure. About that they will learn empirically.
Yup! And I didn't mean to sound so negative (sorry). I do hope it works (and want to hear about it when it does!). I've definitely gotten really excited about assignments before when I thought they were neat and that the students ought to be able to figure everything out---but which turned out to be just a bit too hard and thus demoralising rather than empowering. (If that happens, it's still not worth dropping---twe…
I really got your point now. I thought about the "demoralising X empowering" and my solution for that was to work with pairs of students. Working as a team, they can discuss and motivate each other.
When I blog about the results, I will highlight the number of pairs that completed, partially completed and did not complete the assignment.
Re: I told my 2nd year CS students to create a programming language
#66Earlier quoted context omitted.
The Dragon book may be a fine book but it is mainly a book on parsing, not on compilers. You first learn about control flow graphs in chapter 9! Most courses probably won't even get that far. The parts that are about compilation are very old fashioned, essentially a book about "how to compile Fortran to inefficient code like they did in the '60ies". It would be great if there was a book on modern compiler techniques,…
http://www.cs.princeton.edu/~appel/modern/ml/ http://store.elsevier.com/product.jsp?isbn=9780120884780 Two of the most important books I own. Also, thank you for tearing down the dragon book -- I was going to do the same myself. The dragon book is outdated on parsing, too. It's from a time where single-pass parsing and compilation was sometimes necessary because you didn't have enough memory (or time) to do multiple…
Re: I told my 2nd year CS students to create a programming language
#67Earlier quoted context omitted.
The Dragon book may be a fine book but it is mainly a book on parsing, not on compilers. You first learn about control flow graphs in chapter 9! Most courses probably won't even get that far. The parts that are about compilation are very old fashioned, essentially a book about "how to compile Fortran to inefficient code like they did in the '60ies". It would be great if there was a book on modern compiler techniques,…
http://www.cs.princeton.edu/~appel/modern/ml/ http://store.elsevier.com/product.jsp?isbn=9780120884780 Two of the most important books I own. Also, thank you for tearing down the dragon book -- I was going to do the same myself. The dragon book is outdated on parsing, too. It's from a time where single-pass parsing and compilation was sometimes necessary because you didn't have enough memory (or time) to do multiple…
I don't trust this book; it has an error that I reported to the authors twice but never heard a word back (or any note of the error in their list of errata).
Here's what I wrote to them:
Subject: Errata for "Engineering a Compiler"
Date: Sat, May 26, 2007 at 8:12 PM
Hello,
I noticed that your section on DFA minimization is labeled
"Hopcroft's Algorithm," but doesn't seem to describe the
algorithm explained by Hopcroft in his 1971 paper [0]. Your
algorithm appears to be n^2, where Hopcroft's is n log n. David
Gries gave a somewhat more digestible presentation of the same
algorithm in a follow-up paper in 1972 [1].
Hope this information is useful!
Sincerely,
[0] John E. Hopcroft. An n log n algorithm for minimizing states
in a finite automaton. Technical Report: CS-TR-71-190, 1971.
Available online at
ftp://reports.stanford.edu/pub/cstr/reports/cs/tr/71/190/CS-TR-71-190.pdf
[1] David Gries. Describing an algorithm by Hopcroft. Acta
Informatica, 2(2):97-109. Online reference:
http://www.springerlink.com/content/r5631549671g6251/
> The dragon book is outdated on parsing, too. It's from a time where single-pass parsing and compilation was sometimes necessary because you didn't have enough memory (or time) to do multiple passes. It certainly doesn't have anything on packrat parsing.I'm pretty sure that all production compilers do one-pass parsing even now because of efficiency concerns. I would be very surprised if any production compiler used packrat parsing which takes O(n) memory.