Книги и журналы » Компьютерная литература » Программирование (книги)
Writing A Compiler In Go / Пишем компилятор на GoГод издания: 2019
Автор: Thorsten Ball
Издательство: Самиздат
Язык: Английский
Формат: PDF
Качество: Издательский макет или текст (eBook)
Интерактивное оглавление: Да
Количество страниц: 284
Описание: This book comes with only a tiny number of instructions: you best read it from start to Წnish and you’ll get the most out of it if you follow along by reading, typing out and playing around with the presented code. That’s it.
This book is a practical book. It is about writing code and building something. If you want to immerse yourself in the theory of programming-language construction you’re better off by choosing one of the canonical textbooks. That’s not to say that you won’t learn anything here, no. I’ll try my best to guide you along and explain what everything is and how the pieces fit together. It just won’t be as academic as a textbook on compilers. But that’s exactly how I intend it to be.
[hr]
Эта книга содержит лишь небольшое количество инструкций: вам лучше всего прочитать ее от начала до конца, и вы получите максимальную отдачу от нее, если будете следовать ей, читая, печатая и играя с представленным кодом. Вот и все.
Эта книга является практической. Она о написании кода и создании чего-то. Если вы хотите погрузиться в теорию построения языков программирования, вам лучше выбрать один из канонических учебников. Это не значит, что вы ничему здесь не научитесь, нет. Я сделаю все возможное, чтобы провести вас и объяснить, что все это такое и как части сочетаются друг с другом. Просто он не будет таким академическим, как учебник по компиляторам. Но именно так я и хочу.
CodeПервая часть[spoiler="Примеры страниц"]

[/spoiler]
[spoiler="Оглавление"]
1 Compilers & Virtual Machines Compilers
Virtual and Real Machines Real Machines
What Is a Virtual Machine?
Why Build One?
Bytecode What We’re Going to Do, or: the Duality of VM and Compiler 2 Hello Bytecode! First Instructions Starting With Bytes
The Smallest Compiler
Bytecode, Disassemble!
Back to the Task at Hand
Powering On the Machine Adding on the Stack
Hooking up the REPL 3 Compiling Expressions Cleaning Up the Stack
Infix Expressions
Booleans
Comparison Operators
Prefix Expressions 4 Conditionals Jumps
Compiling Conditionals
Executing Jumps
Welcome Back, Null! 5 Keeping Track of Names The Plan
Compiling Bindings Introducing: the Symbol Table
Using Symbols in the Compiler Adding Globals to the VM 6 String, Array and Hash String
Array
Hash
Adding the index operator 7 Functions Dipping Our Toes: a Simple Function Representing Functions
Opcodes to Execute Functions
Compiling Function Literals
Compiling Function Calls
Functions in the VM
A Little Bonus Local Bindings Opcodes for Local Bindings
Compiling Locals
Implementing Local Bindings in the VM Arguments Compiling Calls With Arguments
Resolving References to Arguments
Arguments in the VM 8 Built-in Functions Making the Change Easy
Making the Change: the Plan
A New Scope for Built-in Functions
Executing built-in functions 9 Closures The Problem
The Plan
Everything’s a closure
Compiling and resolving free variables
Creating real closures at run time
Recursive Closures 10 Taking Time
[/spoiler]