$37.93 with 24 percent savings
List Price: $49.99

The List Price is the suggested retail price of a new product as provided by a manufacturer, supplier, or seller. Except for books, Amazon will display a List Price if the product was purchased by customers on Amazon or offered by other retailers at or above the List Price in at least the past 90 days. List prices may not necessarily reflect the product's prevailing market price.
Learn more
FREE Returns
In Stock
$$37.93 () Includes selected options. Includes initial monthly payment and selected options. Details
Price
Subtotal
$$37.93
Subtotal
Initial payment breakdown
Shipping cost, delivery date, and order total (including tax) shown at checkout.
Ships from
Amazon.com
Ships from
Amazon.com
Sold by
Amazon.com
Sold by
Amazon.com
Returns
Eligible for Return, Refund or Replacement within 30 days of receipt
Eligible for Return, Refund or Replacement within 30 days of receipt
This item can be returned in its original condition for a full refund or replacement within 30 days of receipt.
Returns
Eligible for Return, Refund or Replacement within 30 days of receipt
This item can be returned in its original condition for a full refund or replacement within 30 days of receipt.
Payment
Secure transaction
Your transaction is secure
We work hard to protect your security and privacy. Our payment security system encrypts your information during transmission. We don’t share your credit card details with third-party sellers, and we don’t sell your information to others. Learn more
Payment
Secure transaction
We work hard to protect your security and privacy. Our payment security system encrypts your information during transmission. We don’t share your credit card details with third-party sellers, and we don’t sell your information to others. Learn more
Kindle app logo image

Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.

Read instantly on your browser with Kindle for Web.

Using your mobile phone camera - scan the code below and download the Kindle app.

QR code to download the Kindle App

Follow the author

Something went wrong. Please try your request again later.

Build your own Programming Language - Second Edition: A programmer's guide to designing compilers, interpreters, and DSLs for modern computing problems 2nd ed. Edition

4.2 4.2 out of 5 stars 25 ratings

{"desktop_buybox_group_1":[{"displayPrice":"$37.93","priceAmount":37.93,"currencySymbol":"$","integerValue":"37","decimalSeparator":".","fractionalValue":"93","symbolPosition":"left","hasSpace":false,"showFractionalPartIfEmpty":true,"offerListingId":"vTgy%2FqMps4dFJvkw0%2FUXMIuNE5dYWM7%2BnM7kZ1pJ%2FuDeX5qazELApUw0%2FfmF62HpR07FxUIQKRH8gSY7GxJGfjK8jaFxJsF7afFJP4zDtwe2EL%2BU3ZArBmwWzvLUIInsTELa68Uob9%2BOEimwgSeJ2g%3D%3D","locale":"en-US","buyingOptionType":"NEW","aapiBuyingOptionIndex":0}]}

Purchase options and add-ons

Learn to design your own programming language in a hands-on way by building compilers, using preprocessors, transpilers, and more, in this fully-refreshed second edition, written by the creator of the Unicon programming language.

Purchase of the print or Kindle book includes a free PDF eBook

Key Features

- Takes a hands-on approach; learn by building the Jzero language, a subset of Java, with example code shown in both the Java and Unicon languages

- Learn how to create parsers, code generators, scanners, and interpreters

- Target bytecode, native code, and preprocess or transpile code into a high-level language

Book Description

There are many reasons to build a programming language: out of necessity, as a learning exercise, or just for fun. Whatever your reasons, this book gives you the tools to succeed.

You'll build the frontend of a compiler for your language and generate a lexical analyzer and parser using Lex and YACC tools. Then you'll explore a series of syntax tree traversals before looking at code generation for a bytecode virtual machine or native code. In this edition, a new chapter has been added to assist you in comprehending the nuances and distinctions between preprocessors and transpilers. Code examples have been modernized, expanded, and rigorously tested, and all content has undergone thorough refreshing. You'll learn to implement code generation techniques using practical examples, including the Unicon Preprocessor and transpiling Jzero code to Unicon. You'll move to domain-specific language features and learn to create them as built-in operators and functions. You'll also cover garbage collection.

Dr. Jeffery's experiences building the Unicon language are used to add context to the concepts, and relevant examples are provided in both Unicon and Java so that you can follow along in your language of choice.

By the end of this book, you'll be able to build and deploy your own domain-specific language.

What you will learn

- Analyze requirements for your language and design syntax and semantics.

- Write grammar rules for common expressions and control structures.

- Build a scanner to read source code and generate a parser to check syntax.

- Implement syntax-coloring for your code in IDEs like VS Code.

- Write tree traversals and insert information into the syntax tree.

- Implement a bytecode interpreter and run bytecode from your compiler.

- Write native code and run it after assembling and linking using system tools.

- Preprocess and transpile code into another high-level language

Who this book is for

This book is for software developers interested in the idea of inventing their own language or developing a domain-specific language. Computer science students taking compiler design or construction courses will also find this book highly useful as a practical guide to language implementation to supplement more theoretical textbooks. Intermediate or better proficiency in Java or C++ programming languages (or another high-level programming language) is assumed.


Amazon First Reads | Editors' picks at exclusive prices

Frequently bought together

$37.93
Get it as soon as Wednesday, Jul 17
In Stock
Ships from and sold by Amazon.com.
+
$25.00
Get it as soon as Wednesday, Jul 17
In Stock
Ships from and sold by Amazon.com.
+
$44.49
Get it as soon as Monday, Jul 15
In Stock
Ships from and sold by Amazon.com.
Total price:
To see our price, add these items to your cart.
Details
Added to Cart
spCSRF_Control
Choose items to buy together.

From the Publisher

build a programming language

Learn to build a programming language from scratch by following along with experienced programming language developer, Dr. Clinton L. Jeffery. This book will give you a high-level view of all the stages of language development; from planning and design, through lexical and syntax analysis, to the creation of syntax trees and symbol tables. You'll also learn bytecode and native code generation, and later explore high-level topics like IDE syntax coloring and garbage collection.

As you progress through the chapters, you’ll learn how to build your own programming language by doing. You'll get hands-on by building JZero, a subset of the Java programming language. What’s more, all examples are demonstrated in both Java and Unicon, so you can explore the code in whichever language you are most comfortable reading. This fully revised second edition comes with new coverage on preprocessors and transpilers, and an updated chapter on syntax coloring. All code has been reviewed and updated where necessary.

build a language

code like a pro

topics in book

Why build a new programming language?

There are numerous reasons. One major benefit is the freedom to create your own domain-specific language with built-in operators and functions that simplify the specific jobs you need to get done.

What will you be able to do after reading this book?

Whether you use the book for study, work, or even a side project, after finishing this book, you'll be equipped to take your ideas for a new programming language and turn them into a reality.

What key topics does the book cover?

The key topics in this book are multi-language declarative specifications, syntax tree traversals, bytecode interpreters and runtime systems.

programming guide

new in this edition

high-level programming

How does this book differ from other books on programming language design?

Where most other books on programming language design focus on pure adherence to a major paradigm such as object-oriented or functional computing, Build Your Own Programming Language takes a pragmatic, multi-paradigm approach. You’ll learn the basics and then be able to apply them to the type of language you want to create.

What's new in this edition of Build Your Own Programming Language?

The second edition of Build Your Own Programming Language features a new chapter on preprocessors and transpilers, as well as a rewritten chapter on adding syntax coloring to an IDE, which addresses syntax coloring in VSCode.

Is this the right book for you?

To get the most out of this book, you’ll need intermediate-level knowledge or proficiency in Java, or some other high-level programming language. Beyond that you only need a desire to build your own programming language, a computer, and the willingness to learn.

Editorial Reviews

Review

“I can solidly recommend this book! [It] takes a cohesive approach to not only the technology itself, but the design patterns and wider SDLC that should be considered to deliver a complete solution. You can see the author is aware of evidence-based approaches to process (i.e. Forsgren, Humble, Kim). I also appreciate how they went in-depth into […] not only your standard frontend to backend dissection, but also scaling, decoupling, multi-region, intersystem concerns, events, [and] observability.”

Imran Ahmad PhD, Senior Data Scientist, Canadian Federal Government

About the Author

Clinton L. Jeffery is Professor and Chair of the Department of Computer Science and Engineering at New Mexico Institute of Mining and Technology. He received his B.S. from the University of Washington, and M.S. and Ph.D. degrees from the University of Arizona, all in computer science. He has conducted research and written many books and papers on programming languages, program monitoring, debugging, graphics, virtual environments, and visualization. With colleagues, he invented the Unicon programming language, hosted on the Unicon website.

Imran Ahmad has been a part of cutting-edge research about algorithms and machine learning for many years. He completed his PhD in 2010, in which he proposed a new linear programming-based algorithm that can be used to optimally assign resources in a large-scale cloud computing environment. In 2017, Imran developed a real-time analytics framework named StreamSensing. He has since authored multiple research papers that use StreamSensing to process multimedia data for various machine learning algorithms. Imran is currently working at Advanced Analytics Solution Center (A2SC) at the Canadian Federal Government as a data scientist. He is using machine learning algorithms for critical use cases. Imran is a visiting professor at Carleton University, Ottawa. He has also been teaching for Google and Learning Tree for the last few years.

Product details

  • Publisher ‏ : ‎ Packt Publishing; 2nd ed. edition (January 30, 2024)
  • Language ‏ : ‎ English
  • Paperback ‏ : ‎ 556 pages
  • ISBN-10 ‏ : ‎ 1804618020
  • ISBN-13 ‏ : ‎ 978-1804618028
  • Item Weight ‏ : ‎ 2.11 pounds
  • Dimensions ‏ : ‎ 1.05 x 7.5 x 9.25 inches
  • Customer Reviews:
    4.2 4.2 out of 5 stars 25 ratings

About the author

Follow authors to get new release updates, plus improved recommendations.
Clinton L. Jeffery
Brief content visible, double tap to read full content.
Full content visible, double tap to read brief content.

Clint Jeffery is Professor and Chair of the Department of Computer Science and Engineering at New Mexico Institute of Mining and Technology. He received a B.S. in 1987 from the University of Washington, and M.S. and Ph.D. degrees in 1989 and 1993 from the University of Arizona, all in computer science. He has authored many books and papers in the areas of programming languages, program monitoring, debugging, graphics, virtual environments and visualization. He is a co-founder and administrator of the Unicon programming language and its website, unicon.org.

Customer reviews

4.2 out of 5 stars
4.2 out of 5
25 global ratings

Top reviews from the United States

Reviewed in the United States on February 1, 2024
I've always had an interest to learn how programming languages are made and this book solved that problem. It non only covers just how to build the language, but why! I think most books dont' always cover the why, but just the how. There's a lot of advanced content in here, but it's presented in a way that makes sense. This is a must-buy for those who are interested to build their own programming language!
2 people found this helpful
Report
Reviewed in the United States on April 5, 2024
The good:
The book does a fantastic job carrying the reader from start to finish in making a programming language. It covers just enough theory to unlock the next step. Said another way, it doesn't get bogged down. When there is additional information the reader might want, the book either mentions it or links to it so the author can continue with the pacing. The book also uses real tools (teaching you to use them) along the way. It is as real as it gets.

I've read other books on this topic and I can't make these same claims about those other books.
If I were teaching a class on this and had to pick one book for my students, I think this would be it. The dragon book is the tried-and-true classic here. But it is heavier on the theory, to the point where I think students would not feel like they made as much actual progress.

The meh:
There were moments where a new topic didn't click for me. The author gives enough information that you can pause and look it up elsewhere. So this isn't much of a problem. There were also moments that the topic being covered felt drawn out. These were rare and clearly just for completion's sake. Ultimately, these weren't a problem. And another reader might click earlier or later than me. So I'm not worried about this. But I did notice it.

Also, the book uses two programming languages as it goes along. On one hand, it helps to see multiple examples. On the other hand, the author tries to share as much as possible between the languages, so the "multiple examples" idea goes out the window and it feels a bit like there was no need for two. It isn't a problem and doesn't get in the way. It's just "meh".

The bad:
Although the book does a good job mentioning when additional information can be looked up, I felt like sometimes it didn't provide enough information to know what to look up. An example is in the lexer, the book mentions using regexes isn't perfect but then just moves on. I would have appreciated something like "If you want to learn why, look up ____". The book normally does a good job of this so this problem is rare. And at the end of the day, the goal of this book is to make a programming language--not to understand every bit of theory involved. So I'm pointing it out, but I'm not bothered by it.

Final verdict:
I strongly recommend this book. Even though I've read plenty of other books on the topic, I still had material click for me when reading this book. And I appreciate that this book uses real tools along the way.
Reviewed in the United States on June 2, 2024
I received this as a gift and was sceptical about why I needed to build my Programming language. However, it was an insightful, technical, and thought-provoking read, so I should. This unlocks tremendous potential for specific data/tasks for my job. I am still determining if I will use unicorn programming language only due to my ignorance. However, the author makes every effort to walk you through concepts, theory, and practical matters to make your project successful. This was a tremendous read for someone who had never considered building their programming language, and it has unlocked many theoretical projects.
I look forward to the next revision to optimise the code or a project that was optimised (with examples) this will help the reader grow into more advanced projects.
Reviewed in the United States on April 23, 2024
Build Your Own Programming Language, Second Edition is a very interesting book, because it covers something that many people and technologists do not necessarily consider. The concept of developing your own programming language is something that many do not necessarily consider and the opening of the book addresses some areas where you may want to do just that. With this in mind, The book specifically notes that the book is for the following:

"software developers interested in the idea of inventing their own language or developing a domain-specific language. Computer science students taking compiler construction courses will also find this book highly useful as a practical guide to language implementation to supplement more theoretical textbooks."

I think you could add those wanting to dig deeper into the computer science fundamentals around development.

The book covers a lot of information in its 515+ pages. I see this as a book that bridges the traditional development classroom and texts with those that take a more self-paced approach to learning. The authors, Clinton Jeffery and Imran Ahmad, take a very practical approach to this subject matter. Chapter 1 begins with why design your own programming language as well as noting that most would rather design libraries for pre-existing languages. The follow on to this is how to approach building your new language and each chapter builds on these fundamental concepts, including Chapter 17, Garbage Collection, which is something that can make or break a language and an area that popular languages such as Java still has issues with. The book also uses the Unicon programming language as a basis for comparative examples. Unicon is a descendant of Icon, which is not necessarily widely used, but neither would the new language the reader may develop. The approach also compares with more common languages such as Java.

This book is not for everyone, but it is a very good manual and book for the targeted audience and subject matter. If you are a developer and you want to expand your capabilities and your understanding of languages in general, including writing your own language, this book is for you and a valued addition to your library.
Reviewed in the United States on May 23, 2024
This book teaches just enough about a myriad of tools to confuse the average reader. It offers no help whatever in designing your own programming language. The text,overall, seems to be a thinly veiled advertisement for the Unicon programming language.

Top reviews from other countries

G Osborne
5.0 out of 5 stars A practical guide to designing a computer language
Reviewed in the United Kingdom on March 4, 2024
I have always had an interest in computer language creation. There are many languages, both generic (C, Python) and more domain related (R, Kotlin). At the fundamental level I had a copy of Aho/Sethi/Ullman's classic on Compilers. That book majored on Automata and parsing and the theory of compilers. This book will actually get you to the point of developing a new computer language (though why you might it doesn't say).
What is fascinating for me is that back in the day I used a (domain specific language) called Icon for processing massive corpora of texts due to its superb text processing features. This book uses Java, and Unicon for a development platform. Unicon is a development of the Icon I used years ago, and Mr Jeffery is part of the team that maintains it, so this as a great excuse to get back into that :-) . This is a great way to learn (Un)Icon.
Unlike the Aho.. book reference above this is a more practical book, full of examples and code segments (all on Github of course) and includes sections on transpilers (aka cross-compilers) and even (in 2e) IDEs, which is timely as a lot of languages are now as defined by their normal IDE as by their reserved words and library references - a good example being Python.
The key sections are very practical chapters on parsing - and handling different data types, including tree traversal, and code generation (byte-code, intel x64 assembler). If you are interested in languages, and have heard of yacc and wondered how something like that works this is the book. Its also a good book on how processors handle instructions as that is a crucial part of the exercise. At the end of every chapter there are questions to test your understanding, and this is where books like this pay off - else otherwise you just download the code and run it. The references in the back of the book are very comprehensive and cover many generations of compiler/language design.
If you know any undergraduate ComSci students then this is a great book covering many fundamentals of the subject but in a practical way. Very much recommended.
Full disclosure this copy came from publishers packt