Live data from Hacker News

I told my 2nd year CS students to create a programming language

dovyski.com

21–30 of 67 posts

Re: I told my 2nd year CS students to create a programming language

#21
Go check out Peter Norvig's "Write a lisp interpreter in Python": http://norvig.com/lispy.html

It's a very slick implementation. BTW, we had a similar requirement for our "Programming Languages" undergraduate course: to implement our own language with a BNF grammar, parser, etc (done in ML). It was one of the best learning experiences we had!

Re: I told my 2nd year CS students to create a programming language

#22

I am in a principles of programming languages class currently, and we are doing very similar work. We are writing interpreters, type checkers, and more for a new language our teacher has defined. We are doing all of this in Scala.

Cool! It looks like you are creating a more robust interpreter. The one I told them to implement is simpler (no type check, for instance).

Re: I told my 2nd year CS students to create a programming language

#23

So, from what I understand, they have the flexibility to choose their own syntax. If they're interested in doing the least amount of work possible, they could either implement a Lisp-like language or Forth. (Smalltalk is pretty teeny as well. A basic Smalltalk-y language would weigh in at 1/6th the size of Python's grammar.)

One pair of students decided to create a stack-based language. I guess they noticed it would save several lines of code and make the interpretation process easier to do.

Re: I told my 2nd year CS students to create a programming language

#24
post #21

Go check out Peter Norvig's "Write a lisp interpreter in Python": http://norvig.com/lispy.html It's a very slick implementation. BTW, we had a similar requirement for our "Programming Languages" undergraduate course: to implement our own language with a BNF grammar, parser, etc (done in ML). It was one of the best learning experiences we had!

Thanks for the link and for sharing your experiences. Based on what you said, it looks like I'm on the right track to create a great learning experience. Nice :)

Re: I told my 2nd year CS students to create a programming language

#25
I did something like this once many years ago for one of my wife's students, a precocious high-schooler who needed to be challenged beyond the elementary Fortran she was teaching at the vocational school. So I outlined the steps it would take to translate a toy language into a toy computer's instruction set, and reviewed it with the young man one afternoon at my office - an abbreviated compiler theory class with an eager audience of one. Tom took the big flowchart that we made home, studying and meticulously documenting it. When he brought me the documented design a couple of days later I asked him to implement it.

Tom spent awhile doing this in Waterloo Fortran, and when he presented me with the working compiler I said "Good job. Now execute the code." He blinked his surprise - until then I don't think he'd considered that the toy machine could have been interpreted. A revelation! He went back home and wrote the VM for the toy machine without any assistance; it worked well and I was as proud of him as I could be.

A couple of years later I hired Tom and a couple of years after that he lapped me, going on to better things. 30 years later I still keep a copy of his compiler and interpreter, reminding me from time to time of the bright kid who grew up to become a fine programmer and family man.

Re: I told my 2nd year CS students to create a programming language

#26

I 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.

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:)

Re: I told my 2nd year CS students to create a programming language

#27
This is great. More professors need to be like you.

With the exception of barely 2 projects in uni, all my homework/projects were short and small scale, meaning I already knew how to complete 90% of it, and just had to learn the content from the latest lecture to complete the rest.

With this assignment I probably would have known ~40%, meaning I wold have to buckle down and actually get invested - figure out what I know and don't know, and self study to the answer. Because I wouldn't just be able to rely on my teacher and lecture notes, I would actually have to take (some) control of my learning to succeed (rather than expect the teacher and textbook to hand feed me everyone I need to know). Because I'm not hand fed everything, I would actually become motivated because my success (or failure) for once would be somewhat in my own hands. What a concept!!! Congrats.

Re: I told my 2nd year CS students to create a programming language

#28
This is great. More professors need to be like you.

With the exception of barely 2 projects in uni, all my homework/projects were short and small scale, meaning I already knew how to complete 90% of it, and just had to learn the content from the latest lecture to complete the rest.

With this assignment I probably would have known ~40%, meaning I wold have to buckle down and actually get invested - figure out what I know and don't know, and self study to the answer. Because I wouldn't just be able to rely on my teacher and lecture notes, I would actually have to take (some) control of my learning to succeed (rather than expect the teacher and textbook to hand feed me everyone I need to know). What a concept!!! Congrats.

Re: I told my 2nd year CS students to create a programming language

#30

I did something like this once many years ago for one of my wife's students, a precocious high-schooler who needed to be challenged beyond the elementary Fortran she was teaching at the vocational school. So I outlined the steps it would take to translate a toy language into a toy computer's instruction set, and reviewed it with the young man one afternoon at my office - an abbreviated compiler theory class with an e…

Thank you. Though you only helped one kid, someone else helped me...

...I was once the precocious high-schooler; in my History class I put a .com file in the program's directory that ran a look-alike program which didn't in fact work - on perhaps the only IBM PC in the school.

(Since DOS executed .com's first, and only the .exe if no .com was found, adding a .com was a prank and harmless, but that didn't help my case.)

It was only a few years later, me interviewing for a job at a tech company that the manager told me he was my History teacher's husband, and had cleaned up my mess.

I could only thank him for both placating my teacher and then going on to offer me a job.

In hindsight, I could have figured out that the nicest PC in the school wouldn't be there just out of sheer random chance...

Post reply on HN