How to Create Pragmatic, Lightweight Languages

Book retirement

We retired the book in January 2023. The Author started working on the book in the summer of 2016. He soon released the first few chapters and started collecting feedback, working on that for many months before getting the first complete version out.

At that time, we did not expect more than eight hundred people could buy this book. We did not anticipate there would be so much interest in this topic and that many enthusiasts would demonstrate their trust by buying this book.

Many things have gone on since the book was released, and we expanded the idea presented in the book. Over time, we refined the patterns present in the book and created a set of open-source libraries to apply those ideas in practice. We have since then learned a lot by applying that code and those ideas to Language Engineering projects for tens of clients.

As we refined our understanding of what became the StarLasu methodology, the book started to remain behind. For this reason, we have decided to retire it.

You can watch below the webinar we organized for the Book Retirement!


Testimonials

For those of you who have decided to build your own language or tool, and thus have the necessary impetus, I can recommend this as THE entry level guide to lexing, parsing and compiling. No prior experience required!

Nikos Vaggalis, i-programmer

I just bought ‘How to create a pragmatic, lightweight language’ book and I want to say thank you. I have ‘Using ANTLR Like A Professional: Basic Edition’ course too. I’m not up to day with any of these materials because I’m learning parsing techniques first, specially building recursive descent parsers by hand (just for getting the ability) but I’m pretty sure I’ll be getting my hands dirty with these wonderful resources.

August 03, 2020 – Irwin Rodriguez

Why Build a Language?

In this book we will show you how to build languages and the tools to support them.

For starters, it’s a challenge and that is motivation enough for some people. Maybe that’s why you are here. And if that is the reason, I promise it’s going to be a good challenge and you are going to have fun meeting it. But there are other good reasons.

With the help of this book you will learn how to:

  • develop tools for a language, like a static analysis engine for Java or a transpiler from Python to JavaScript;
  • build a domain-specific language (DSL), a language really good at specific tasks, like HTML or SQL;
  • create a general-purpose language (GPL), a language suitable for any task, like C# or Ruby;
  • create an esoteric-programming language, a  language designed to make a point, like Piet or Shakespeare.


Creating a tool or a DSL can simplify your life as a programmer. And when your employer hears the magic words “increase productivity” it can even help in your job.

Creating an esoteric programming language can be a great way to put a new idea out there. To show that things can be done differently.

It is harder to succeed creating a GPL, but it can be done: Kotlin, Go, Ruby, Julia, Rust, etc. Just think about the many new languages created in the last decade. Many of them have taken hold in various communities and made developers happier.

A Bit of Theory and Lots of Code

When I was learning how to build languages I was disappointed: I could just find basic tutorials here and there, but what was missing was a complete course. One organized to lead me from the very beginning to the end. Whenever I found something more advanced, it was too abstract: a lot of compiler theory and not enough code.

I wanted a book with a clear plan and a pragmatic approach, but there wasn’t one.

That is when I decided to learn how to build languages on my own. It took me years of professional experience in building languages to get there. Now I can share this knowledge, so that you can learn how to create your own language in a few weeks.

It’s still going to be a lot of work, but you will have help.

How This Book Will Help You

This book shows how to reuse existing libraries and frameworks to create the necessary ecosystem to support our languages.

The cost of building the machinery to properly support a language used to be very high.

Today, with a limited effort, we can design a language and:

  • obtain a fast parser from a concise grammar definition;
  • obtain validation and model transformations with little code;
  • generate JVM bytecode and get interoperability with other JVM languages or generate the language with the help of LLVM;
  • obtain rich editors with syntax highlighting and autocompletion.

We will show you how to build all of this and more by defining small components in a smart way. The result will be something solid, complete and understandable.

The programming language used is Kotlin, but the techniques are universal and can be used with any language.

About the author

Federico Tomassetti is a Consultant Software Architect specialized in Language Engineering: I build languages, editors, parsers, compilers, interpreters and simulators.

Federico has an insane passion for Software Development: he has loved it since he was 8 years old and keeps thinking about it all the time. He got his PhD in Software Engineering, did research and worked in Italy, Germany, Ireland and France. He is an active speaker at meetups and scientific conferences, and he writes papers and articles. He is Founder & CEO of Strumenta, a Language Engineering consultancy boutique. He worked for TripAdvisor and Groupon.

Table of Contents

Part 0: Creating a Language

  1. Motivation: why do you want to build language tools?
  2. The general plan
  3. The example languages we are going to build

Part I: the foundation

  1. Writing a lexer
  2. Writing a parser
  3. Mapping: from the parse-tree to the Abstract Syntax Tree
  4. Symbol resolution
  5. Typesystem
  6. Validation

Part II: compiling

  1. Build an interpreter
  2. Generate JVM bytecode
  3. Generate an executable using the LLVM

Part III: editing support

  1. Syntax highlighting
  2. Autocomplete

Three Packages

100% Satisfaction Guaranteed
If you are not happy, just ask for a refund.

Basic edition


  • Ebook with 370 pages of content
  • 3 formats: PDF, ePUB and Mobi (Kindle)
  • Invitation to the reserved area of the Strumenta community on Language Engineering

Standard edition


  • Ebook with 370 pages of content
  • 3 formats: PDF, ePUB and Mobi (Kindle)
  • Invitation to the reserved area of the Strumenta community on Language Engineering
  • The whole source code with in addition build files and tests. Ready to be used in your own projects

Not Ready to Buy the Book Yet?
Start With the Free Email Course!