This is the code repository for Build Your Own Programming Language , published by Packt.
A programmer's guide to designing compilers, interpreters, and DSLs for solving modern computing problems
The need for different types of computer languages is growing rapidly and developers prefer creating domain-specific languages for solving specific application domain problems. Building your own programming language has its advantages. It can be your antidote to the ever-increasing size and complexity of software. However, creating a custom language isn't easy.
This book covers the following exciting features:
- Perform requirements analysis for the new language and design language syntax and semantics.
- Write lexical and context-free grammar rules for common expressions and control structures.
- Develop a scanner that reads source code and generate a parser that checks syntax.
- Build key data structures in a compiler and use your compiler to build a syntax-coloring code editor.
- Implement a bytecode interpreter and run bytecode generated by your compiler.
- Write tree traversals that insert information into the syntax tree.
- Implement garbage collection in your language.
If you feel this book is for you, get your copy today!
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
procedure main(argv)
simple := simple()
yyin := open(argv[1])
while i := yylex() do
write(yytext, ": ", i)
end
Following is what you need for this book: 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 construction courses will also find this book highly useful as a practical guide to language implementation to supplement more theoretical textbooks. Intermediate-level knowledge and experience working with a high-level language such as Java or the C++ language are expected to help you get the most out of this book.
With the following software and hardware list you can run all code files present in the book (Chapter 1-17).
Chapter | Software required | OS required |
---|---|---|
3-16 | Uflex, Jflex, Unicon, Java | Windows, Mac OS X, and Linux (Any) |
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.
The Code in Action videos for this book can be viewed at https://bit.ly/3njc15D.
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.
If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.