Live data from Hacker News

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

dovyski.com

11–20 of 67 posts

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

#11

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.

We have a class on compilers at my university, but it's on the 4rd year. Creating a compiler/interpreter when you are just starting programming would be a big challenge.

@dovyski: it's nice to see this coming from a brazilian university -- I'm from UFABC, São Paulo

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

#12
Couldn’t commend you more highly for this—not least because it’s exactly what I would do if I were a CS professor. ;)

Interpreters, compilers, and games are the things that have taught me the most about programming and computing in general. Implementing programming languages pushes high-level CS concepts as well as firsthand understanding of how languages work. Games are a fun practical application of those concepts—embedded scripting languages in particular—plus trig, vectors, matrices, rendering, optics, audio, DSP, physics, you name it. And languages and games both provide plenty of opportunities to learn about optimisation.

I hardly know why CS is taught any other way.

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

#13
I'm happy to see you taking this philosophy, but... Why isn't your school pushing them to do things like this in their first year, or even their first semester? We wrote an interpreter for another language in my very first CS course (the one designed for students with no experience), and writing your own language/compiler was required midway into the 3rd semester (as extra credit, the language we wrote/compiled could support functions/lambdas and recursion). And the only reason I continued in CS beyond the intro course was because I got to solve really hard problems in interesting ways.

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

#14
post #6
post #2

Cool! It's interesting that you want them to make a procedural language, although if they started with C, it makes some sense. I wonder if you could broaden the experiment slightly by relaxing your constraints and saying they either need to allow reassignment of variables, or else support lambdas, and in exchange they can assume immutability.

Thanks! I think a procedural language makes more sense for them at this time. They are just learning OOP, so it would be hard to implement an interpreter for that. About your suggestion, that's cool. I think most of them are already assuming immutability and using floats/doubles as the type of all variables.

I agree with your blog post that it's a more interesting assignment than yet-another-Tic-Tac-Toe clone. I wish more curricula did this, and earlier! I think after the assignment is done it'd be worthwhile to show them that they can get all the Java-style OOPy features with just lexical closures, and I think showing Forth as a powerful, simple, and simple-to-implement language would be neat too. (Also yacc and lex deserve a mention, I like this PDF that accomplishes the goal of the assignment: http://www.scribd.com/doc/8669780/Lex-yacc-Tutorial )

If you relaxed the constraint on syntax and just stipulated Turing-completeness, it would be very amusing if someone implemented a clone of Brainfuck. ;) (Especially for the unlucky pair who has to write two programs for it!)

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

#16

Couldn’t commend you more highly for this—not least because it’s exactly what I would do if I were a CS professor. ;) Interpreters, compilers, and games are the things that have taught me the most about programming and computing in general. Implementing programming languages pushes high-level CS concepts as well as firsthand understanding of how languages work. Games are a fun practical application of those concepts—…

Thanks!

I totally agree with you. My student's next assignments will be game-related: develop an agent to fight inside an arena and create a Guitar Hero like game.

I really think they will learn more and better if they have to accomplish that kind of assignments.

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

#17
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.)

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

#18

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.

Sounds like a terrible place to be honest. With that mentality, in 60 years (when current compile designers are dead), nobody will know anything about compiler architecture.

On the third year at my university, there's a course centered around writing a Java compiler.

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

#19
post #14
post #6

Earlier quoted context omitted.

Thanks! I think a procedural language makes more sense for them at this time. They are just learning OOP, so it would be hard to implement an interpreter for that. About your suggestion, that's cool. I think most of them are already assuming immutability and using floats/doubles as the type of all variables.

I agree with your blog post that it's a more interesting assignment than yet-another-Tic-Tac-Toe clone. I wish more curricula did this, and earlier! I think after the assignment is done it'd be worthwhile to show them that they can get all the Java-style OOPy features with just lexical closures, and I think showing Forth as a powerful, simple, and simple-to-implement language would be neat too. (Also yacc and lex des…

Thanks for the words and suggestions! About yacc they will meet that when they attend the compiler course.

I didn't see a Brainfuck clone yet, but I saw something in the same level of oddity. It was a language called "Star Wars", I guess. I can remember some commands such as "Darth Vader told to a = 1" and "Skywalker from 0 to 10" haha :)

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

#20
post #11

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.

We have a class on compilers at my university, but it's on the 4rd year. Creating a compiler/interpreter when you are just starting programming would be a big challenge. @dovyski: it's nice to see this coming from a brazilian university -- I'm from UFABC, São Paulo

It's a big challenge indeed. About the compiler course, it's the same at UFFS: 4th year.

Thanks and nice to see a brazilian fellow around here :)

Post reply on HN