-- Leo's gemini proxy

-- Connecting to iceworks.cc:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Crafting Interpreters

Created: 2020-08-27T02:40:52.243421

Return to the Index

This card pertains to a resource available on the internet.


Lexical analysis: turning a stream of symbols in to meaningful chunks such as strings, numbers, punctuation pieces.

Parsing: turning a stream of lexically analyzed chunks in to a meaningful and categorized tree.

Parsing creates an "abstract syntax tree."

Static analysis: learns things about a program based on what you can tell without having to run it. For example if a variable appears to ever be used or written to.

Intermediate representation: a format you convert code in to before turning it in to what it's supposed to be.

Optimization: walking over code and replacing it with equivalent but better peforming code.

p-code: "portable" or "bytecode" which can be adapted to run on different CPUs through a "virtual machine."

Transpiler: converts one set of source code to another set of source code. People will bikeshed about the difference between a compiler and a transpiler.

Dynamically typed: slots can hold any type of object and the type can change.

Statically typed: slots can only hold specific types of objects which are specified when the code is written.

Classes: a set of attributes common to all instances of the class.

Prototypes: objects which may defer data they do not know to another parent object, but each object is truly its own.

Context free grammars

Meta programming: using programs to help write programs.

Visitor pattern

Pretty printer: walking a syntax tree and producing code from it.

Recursive descent parsing

Talks about variable scoping, implementing closures in an interpreter.

Pratt parsers. Dispatching on punctuation and looking at operator precedence. Doesn't explain what pratt parsers are in much detail though.

Mark&Sweep collectors: one phase marks all things which can be seen from a root, another phase frees memory pages which are not properly marked.

Modulos on numbers which are powers of two can be more optimally implemented as bit masks.

NAN Boxing


Lexing and Parsing

Lexing turns this:

World henlo: 'Hi.'

In to this:

IDENT(World) IDENT(henlo) COLON STRING(Hi.)

While parsing turns this:

IDENT(World) IDENT(henlo) COLON STRING(Hi.)

In to this:

CALL
OBJECT(World)
FUNCTION(henlo)
PARAMETER(Hi.)

-- Response ended

-- Page fetched on Thu May 23 19:56:56 2024