Skip to content

CS 631-02 Systems Foundations — Meeting Summary

Date: February 10, 2026
Time: 2:45 PM Pacific (US and Canada)
Meeting ID: 882 2309 0019

Quick Recap

  • The session focused on parsing techniques in C and Rust.
  • Professor Greg explained abstract syntax trees (ASTs) and recursive descent parsing.
  • He demonstrated implementing a parser for a simple expression language in C using enum and union types to represent parse nodes.
  • The class discussed memory allocation strategies and code optimization, including:
  • Using maps to reduce redundant code.
  • Avoiding macros in favor of enums and compiler-checked associations.
  • Rust’s ownership model and memory management were introduced and contrasted with C.
  • A live demo used Cloud Code to visualize memory allocation and parse tree construction.
  • Greg emphasized:
  • Writing code by hand to develop deep understanding.
  • Using coding agents for complex analysis and summarization when appropriate.

Next Steps

  • Greg:
  • Post a Google Sheet on Campus Wire for GitHub ID submissions.
  • Upload last week’s lecture links.
  • Students:
  • Submit GitHub IDs in the posted Google Sheet.

Summary

FlashMob Computing: A Supercomputer Story

  • Greg shared his experience leading the FlashMob Computing project (circa 2000), which assembled an ad hoc supercomputer from hundreds of donated machines in a gym using a bootable CD-ROM for self-organization.
  • The project drew attention from prominent computer scientists, including Jim Gray and Gordon Bell.
  • Although he appeared on several tech TV programs, the New York Times front-page feature was his most notable public recognition.

Hands-On Parsing and Compiler Basics

  • Greg highlighted the importance of hands-on practice and the value of productive struggle in learning (referencing research by Anthropic).
  • He explained parsing as:
  • Validating token sequences.
  • Building a tree-structured representation (AST) of a program.
  • He emphasized that foundational parsing techniques generalize across languages and touched on the transition from textual number representations to machine-level forms during parsing.

C Parsing Techniques and Optimization

  • Key principles:
  • Maintain symmetry between token grammar and parsing functions.
  • Prefer enum over macros for readability and compiler-validated associations.
  • Use union to optimize memory by sizing to the largest variant.
  • Memory strategies:
  • Use fixed arrays and simple pool-like allocation to sidestep malloc/free complexity for teaching and prototyping.
  • Tooling:
  • Plan to use Cloud Code to visualize memory updates and parse-tree formation step-by-step.

Token Parsing and Memory Management

  • Parsing functions consume tokens via a scan table and helper routines to manage sequences.
  • The union allocates storage for the largest member; alignment and padding matter for correctness and performance.
  • A wildcard token (e.g., tkne) can match any token type when appropriate.
  • Encourage reuse of code paths for binary operators (e.g., plus and minus) to reduce duplication.

Memory Allocation and Parse Trees

  • Topics covered:
  • Memory padding and alignment for cache efficiency.
  • Recursive parsing of expressions, following EBNF grammar faithfully.
  • Incremental development: implement and test small units before scaling up.
  • Forthcoming resources:
  • An updated starter codebase to visualize memory allocation and parse tree construction.

Rust and C Programming Insights

  • Code quality and maintainability:
  • Avoid redundancy; use data structures like maps for dispatch/association.
  • Prefer readability and compiler optimizations over macros where possible.
  • Coding agents:
  • Write code personally for depth of understanding.
  • Use agents to analyze, summarize, and cross-check complex code.
  • Rust concepts introduced:
  • Enums, boxes, and ownership rules.
  • Memory management without a garbage collector and implications for deallocating tree structures.
  • Looking ahead:
  • Upcoming session (Thursday) will cover Rust debugging and deeper exploration of parsing functions.