Scope is the set of rules that determines how to locate a variable identifier and assign it a value
How is code compiled? There are a few phases
- Tokenizing: characters are broken into chunks - tokens
- Lexing: when the tokenizer invokes the stateful parser rules to figure out whether a chunk is a distinct token or part of another token
- Parsing: we build an Abstract Syntax Tree (AST) from a stream of tokens. The AST represents a structure of a program. For instance: the top-level node called a program and the children nodes could be a variable declarations and function declarations. The variable declarations have children nodes that describe properties of the variable.