Go Lexer and Parser | Saving and Loading Picture Trees | EP 20

Added:

Saving & Loading
Fixing Bugs
Detecting S Key
Finding a Filename
Lexing the File
Writing Lexer
Token Emission
Number Parsing
Parsing Tokens

Saving & Loading

1:28
Playing Section
  • 1

    Plan to save picture trees to text files and parse them back in.

  • 2

    This enables saving favorite images and manual editing of the picture data.

Proficiency in the Go (Golang) programming language, specifically working with structs, pointers, slice manipulation, and custom types.
Fundamental knowledge of tree data structures, hierarchical relationships, and basic tree traversal algorithms.
Understanding of basic File I/O concepts in Go, including reading from and writing to files using the 'os' and 'io' packages.
Conceptual awareness of compiler design phases, specifically the distinction between lexical analysis (lexing) and syntactic analysis (parsing).
Implementing custom Abstract Syntax Tree (AST) evaluators or interpreters to render or process the loaded picture trees.
Developing advanced error-recovery strategies in parsers to handle malformed files gracefully without crashing.
Optimizing lexer and parser performance in Go using buffer pools ('sync.Pool') and minimizing memory allocations.
Comparing custom-designed DSL (Domain Specific Language) formats against standard serialization protocols like JSON, Protocol Buffers, or custom binary formats.
1.3K views22likes1:02:07@JackMottOriginal Release: 2018-02-16

Lexing is the process of breaking raw text into meaningful tokens (like operators, numbers, and parentheses) using a state machine approach, while parsing converts these tokens into an abstract syntax tree (AST) that represents the program's structure; this two-step process enables flexible text file parsing that can handle various formatting like spaces, tabs, and line breaks while correctly identifying logical units in the input.