Create_Your_Own_Programming_Language_2011_Cournoyer.pdf

(1325 KB) Pobierz
TABLE OF CONTENT
1.
Table of Content
2.
Introduction
1.
Summary
2.
About The Author
3.
Before We Begin
3.
Overview
1.
The Four Parts of a Language
2.
Meet Awesome: Our Toy Language
4.
Lexer
1.
Lex (Flex)
2.
Ragel
3.
Python Style Indentation For Awesome
4.
Do It Yourself I
5.
Parser
1.
Bison (Yacc)
2.
Lemon
3.
ANTLR
4.
PEGs
5.
Operator Precedence
6.
Connecting The Lexer and Parser in Awesome
7.
Do It Yourself II
6.
Runtime Model
1.
Procedural
2.
Class-based
3.
Prototype-based
4.
Functional
5.
Our Awesome Runtime
6.
Do It Yourself III
7.
Interpreter
1.
Do It Yourself IV
8.
Compilation
1.
Using LLVM from Ruby
2.
Compiling Awesome to Machine Code
9.
Virtual Machine
1.
Byte-code
2.
Types of VM
3.
Prototyping a VM in Ruby
10.
Going Further
1.
Homoiconicity
2.
Self-Hosting
3.
What’s Missing?
11.
Resources
1.
Books & Papers
2.
Events
3.
Forums and Blogs
4.
Interesting Languages
12.
Solutions to Do It Yourself
1.
Solutions to Do It Yourself I
2.
Solutions to Do It Yourself II
3.
Solutions to Do It Yourself III
4.
Solutions to Do It Yourself IV
13.
Appendix: Mio, a minimalist homoiconic language
1.
Homoicowhat?
2.
Messages all the way down
3.
The Runtime
4.
Implementing Mio in Mio
5.
But it’s ugly
14.
Farewell!
Published November 2011.
Cover background image ©
Asja Boros
Content of this book is © Marc-André Cournoyer. All right reserved. This eBook
copy is for a single user. You may not share it in any way unless you have written
permission of the author.
INTRODUCTION
When you don’t create things, you become defined by your tastes rather than
ability. Your tastes only narrow & exclude people. So create.
- Why the Lucky Stiff
Creating a programming language is the perfect mix of art and science. You’re
creating a way to express yourself, but at the same time applying computer science
principles to implement it. Since we aren’t the first ones to create a programming
language, some well established tools are around to ease most of the exercise.
Nevertheless, it can still be hard to create a fully functional language because it’s
impossible to predict all the ways in which someone will use it. That’s why making
your own language is such a great experience. You never know what someone else
might create with it!
I’ve written this book to help other developers discover the joy of creating a
programming language. Coding my first language was one of the most amazing
experiences in my programming career. I hope you’ll enjoy reading this book, but
mostly, I hope you’ll write your own programming language.
If you find an error or have a comment or suggestion while reading the following
pages, please send me an email at
macournoyer@gmail.com.
SUMMARY
This book is divided into ten sections that will walk you through each step of
language-building. Each section will introduce a new concept and then apply its
principles to a language that we’ll build together throughout the book. All technical
chapters end with a
Do It Yourself
section that suggest some language-extending
exercises. You’ll find solutions to those at the end of this book.
Zgłoś jeśli naruszono regulamin