Fueling innovative software
July 15-18, 2019
Portland, OR

Building a programming language for fun (and maybe profit)

Tim Nugent (Lonely Coffee), Jon Manning (Secret Lab), Paris Buttfield-Addison (Secret Lab)
1:30pm5:00pm Tuesday, July 16, 2019
Live Coding ONLY
Location: D138-140
Secondary topics:  Open Source
Average rating: ****.
(4.33, 21 ratings)

Who is this presentation for?

  • Programmers, anyone with an interest in language development, and demo god fans

Level

Intermediate

Description

Have you ever found yourself wondering, “Hmm, what should I procrastinate with next?”

Luckily for you, Tim Nugent, Jon Manning, and Paris Buttfield-Addison have the answer: build your own programming language! They know what you’re thinking, "Hang on, there. Isn’t that the domain of all those clever boffins hanging out over in Clever Boffinlandia? I’m just a developer.”

But luckily again—wow, you really are lucky today—those same clever boffins have made it easier to make your own programming languages. There are a bunch of reasons why you’d want to make your own language:

  • You’ll gain a better understanding of how programming languages are built and why.
  • It’s fun.
  • You’ll learn to build domain-specific languages to give your users more power without requiring them to learn programming.
  • You’ll have increased respect and empathy for the programming languages you use every day.
  • You can casually throw into conversations that you build your own programming languages.
  • Some formats and data types are more easily parsed as a language than via regex.
  • It’s fun.

Being able to build your own programming language is another tool in you tool belt, and who doesn’t love having a nice heavy tool belt?

“Okay, you’ve convinced me. What do we do?”

Really? Sweet. Well, Tim, Jon, and Paris build their very own programming language from nothing to having a working interpreter using ANTLR. They discuss their programming language design and why and how to implement it in ANTLR’s grammar. They’ll use ANTLR to generate a parser when the grammar is complete and implement their interpreter. They’ll be building their language in JS, but if you’re feeling adventurous, you can use any of the languages ANTLR supports.

You’ll be able to see them take their new language out for a spin, and, if there’s time, take a look at some other options for building languages, such as using PEGs, and some other steps you can take to improve their new language. You’ll leave ready to create your own programming languages and solve new and interesting problems using your newly acquired status as a clever boffin.

Prerequisite knowledge

  • A basic-to-intermediate understanding of programming and programming principles
  • Familiarity with basic command line operation

Materials or downloads needed in advance

  • A machine capable of running ANTLR4 (works on macOS, Ubuntu (and maybe other distros), and Windows)
  • Java (used by ANTLR to generate source files, but you can skip this if you're willing to download files during the tutorial, but it will be less impactful)
  • ANTLR4
  • A browser capable of running JS (hopefully you've all got this one sorted already)
  • Some way of running a basic server for testing your code (we'll be using Python's SimpleHTTPServer but anything you're comfortable using will do)
  • Text editor of your choice (we'll be using VS Code with Mike Lischke's ANTLR4 grammar extension but you go with whatever you know and love).

What you'll learn

  • Understand how ANTLR works to parse languages, how to build domain-specific languages, and how to create programming languages from scratch
  • Learn the steps involved in building a programming language
  • Gain an appreciation for how good programming languages are
  • Appease the demo god
Photo of Tim Nugent

Tim Nugent

Lonely Coffee

Tim Nugent pretends to be a mobile app developer, game designer, tools builder, researcher, and tech author. When he isn’t busy avoiding being found out as a fraud, Tim spends most of his time designing and creating little apps and games he won’t let anyone see. He also spent a disproportionately long time writing his tiny little bio, most of which was taken up trying to stick a witty sci-fi reference in…before he simply gave up. He’s writing Practical Artificial Intelligence with Swift for O’Reilly and building a game for a power transmission company about a naughty quoll. (A quoll is an Australian animal.)

Photo of Jon Manning

Jon Manning

Secret Lab

Jon Manning is the cofounder of independent game development studio Secret Lab. He’s working on the critically acclaimed award-winning adventure game Night in the Woods, which includes his interactive dialogue system Yarn Spinner, and Button Squid, a top-down puzzler. He’s written a whole bunch of books for O’Reilly about iOS development and game development. Jon holds a PhD about jerks on the internet. He’s currently writing Practical AI with Swift for O’Reilly.

Photo of Paris Buttfield-Addison

Paris Buttfield-Addison

Secret Lab

Paris Buttfield-Addison is a cofounder of Secret Lab, a game development studio based in beautiful Hobart, Australia. Secret Lab builds games and game development tools, including the multi-award-winning ABC Play School iPad games, the BAFTA- and IGF-winning Night in the Woods, the Qantas airlines Joey Playbox games, and the Yarn Spinner narrative game framework. Previously, Paris was a mobile product manager for Meebo (acquired by Google). Paris particularly enjoys game design, statistics, blockchain, machine learning, and human-centered technology. He researches and writes technical books on mobile and game development (more than 20 so far) for O’Reilly; he recently finished writing Practical AI with Swift and is currently working on Head First Swift. He holds a degree in medieval history and a PhD in computing. Paris loves to bring machine learning into the world of practical and useful. You can find him on Twitter as @parisba.