top | item 8148087

(no title)

ds300 | 11 years ago

I was a TA on a compilers course that worked backwards. I'd taken the course myself two years earlier when it was taught by a different lecturer and found it excellent, and most of my cohort agreed.

When reversed, however, most of my students found it extremely hard to wrap their head around the the first part of the course, i.e. code generation from an AST. They didn't have sufficient grounding in recursive data structures and algorithms. While this might be a problem with the degree program rather than the compilers course, I believe that learning to write a recursive descent parser (by hand) provides this grounding and makes the code generation bit much easier to grasp.

Unfortunately the new lecturer had also done away with teaching the students how to write parsers by hand, instead encouraging them to use parser generators. I thought that was tragic. One of the best moments of my programming life was writing a recursive descent parser for a non-trivial grammar in one sitting (about 500 lines of python), hitting run and having it just work first time. It was orgasmic.

discuss

order

jdmichal|11 years ago

> One of the best moments of my programming life was writing a recursive descent parser for a non-trivial grammar in one sitting (about 500 lines of python), hitting run and having it just work first time.

This was, in the grand scheme of things, likely offset by the hours of frustration most of the students went through while debugging their parser which did not work perfectly the first time.