8 ms·
I was a TA for a programming languages course taught using this book, and it was one of the most enlightening experiences I've had: Implementing interpreters in
by jasperry 6y ago
I was a TA for a programming languages course taught using this book, and it was one of the most enlightening experiences I've had: Implementing interpreters in Scheme to learn about recursion, environments, closures, objects, continuations. I think of it kind of as the dual of a course on developing a compiler for a static languages.
- ipnon 6y agoStudying programming languages has the same side effects as studying AI. You have to learn some broadly applicable programming tricks to get your programs running. I see closures everywhere after writing my own programming language. Someone might use backtracking in a new domain after studying AI.
- rightbyte 6y agoOne revelation I got from programming a hobby language was that many language feutures seems accidental.
- throwaway_pdp09 6y agoCould you elaborate please?
- rightbyte 6y agoIt's hard to explain but it was a feeling I got. It felt like the language fell into place on it's own when you added stuff and not in a way other code projects do. Parsing with flex/bison "naturally" converged syntax towards other languages because other languages are made so they are easy to write grammar for etc. Whether an "if(exp)" introduces a scope of is own is just down to where you happen to put the push_scope() call, and so on. I wonder how much of C that was just "that is how it happened to turn out".
- coldtea 6y agoWell, for big ideas that are not accidental you need to compare between really unique langauges. E.g. C vs Lisp vs Smalltalk vs APL vs ML/Haskell vs COBOL vs FORTH vs PROLOG
- chrisseaton 6y agoPeople add language features because they're easy to do in the implementation they already have, not because they're well-principled. Concrete example from personal experience: All objects in Ruby have a unique ID. The standard implementation of Ruby added a function to go from the ID to the object. This was easy on the standard implementation of Ruby, because the ID is just the pointer, so you can just cast it. It's a nightmare on more sophisticated implementations of Ruby where an object may not have a single canonical address that you can use as an ID, and you need to store a huge separate mapping.
- throwaway_pdp09 6y agoYeah, once you introduce moving garbage collectors that happens. I'm sure ruby isn't the first language to have made that mistake (I believe some implementations of SQL actually have similar, a reference to the row on disk, and it turned out to be a short-term gain and a long-term mistake).
- _pmf_ 6y agoWould call it "emergent" instead of "accidental".
- pcstl 6y agoDo you know of any good courses on developing compilers for static languages?
- jasperry 6y agoI think a course like that is pretty standard in a lot of larger CS programs. I saw that Stanford has a free online course: https://online.stanford.edu/courses/soe-ycscs1-compilers https://online.stanford.edu/courses/soe-ycscs1-compilers I would be partial to any course that uses Appel's "Modern Compiler Implementation in ML", though that book is getting pretty old now.
- read_if_gay_ 6y agoMy (tiny) CS department has a pretty nice compilers course, I thought. You work on a single, ~10k LoC file [0] that is written in a subset of C, compiles that subset to RISC-V, and also has a small VM and even a hypervisor for running the code it generates. The only thing is, the video lectures are 8 years old [1]. Though last semester, all lectures were online and anyone could join. Might be the same next spring/summer. You’d have to check the professor’s Twitter account. [0]: https://github.com/cksystemsteaching/selfie https://github.com/cksystemsteaching/selfie [1]: https://vimeopro.com/user12798068/university-of-salzburg-introduction-to-compiler-construction/video/47014332 https://vimeopro.com/user12798068/university-of-salzburg-int...
- emmanueloga_ 6y agoMaybe check this bibliography [1] of "Resources for Amateur Compiler Writers"... although I'm not sure what's the "Amateur" part of it... it lists several text books and papers that would take anyone a few years to work through :-/ https://thorstenball.com/books/ https://thorstenball.com/books/ seems like a good star, and if you don't know Go it shouldn't take too long to get acquainted with it. 1: http://c9x.me/compile/bib/ http://c9x.me/compile/bib/
- azhenley 6y agoNot a course [yet], but I did write a tutorial series for my undergrad students: http://web.eecs.utk.edu/~azh/blog/teenytinycompiler1.html http://web.eecs.utk.edu/~azh/blog/teenytinycompiler1.html