Writing an Interpreter in Go
Created: 2020-08-28T04:21:02.170201
Return to the Index
This card pertains to a resource available on the internet.
Most of the book is more of a pre-made Go program broken up with some side notes on how it was written.
- Lexical analysis: stream of text in stream of tokens out
- Read Eval Print Loop
- Pratt parsing, but kind of explains it and sends links to other explanations.
- Entirely tosses memory management to Go's garbage collector, doesn't really go in to the topic.
Tony Hoare introduced null references to the ALGOL W language in 1965 and called this his“billion-dollar mistake”
Kinda like having something explosive inyour car leads you to driving slower and more carefully.
Pratt Parsing
- Has a table of precedence, prefix parsing, and infix parsing, attached to a token type.
- Prefix: the token appears before another; or rather, no symbol precedes it.
- Infix: the token appears between two symbols. Or rather, a symbol precedes it.
- Prefix parsers only receive deference if they have a lower precedence than the current precedence level.