I was speaking with a visitor today about how I think kids learn, and the topic of programming came up. He suggested that one reason people find programming so hard to learn is that the syntax had to be exactly perfect in order to get anything to work. He said imagine if you couldn’t communicate anything in a language until you had perfect syntax; you’d never learn the language!

So my response was, maybe we need to fix the compiler? What if the compiler understood poor syntax and was able to correct it to better syntax for a user (or at least offer some possible suggestions for improved syntax, with examples of the output of each version of the syntax)? Instead of a dumb compiler that needs exactly the right information entered into it, you’d have an intelligent compiler that would be able to interpret poorly written code, and still produce some sort of useful result.

This problem is often addressed by creating incredibly simple syntaxes (for example: block languages, like what exists in Scratch) but as I’ve noticed, students sometimes struggle to convert the block languages into text code blocks. Instead of simplifying the language, let’s widen the range of acceptable syntax, while at the same time still giving some feedback to the learner.

An aside: what if we could do this in math as well?