$ show shuo-liu16/CS61A
This repository is a personal study record for UC Berkeley's CS61A (Structure and Interpretation of Computer Programs) course, completed in 2024. It contains the author's solutions to homework assignments (hw01–10), lab exercises (lab00–12), and four major projects: Hog (dice game), Cats (typing tutor), Ants (tower defense web game), and a Scheme interpreter. The codebase is hybrid in nature: it is primarily an educational portfolio, but it includes several functional application components such as a web-based Scheme editor with interactive visualizations (environment diagrams, substitution trees, turtle graphics), a Flask-based multiplayer typing test, and a real-time web game (Ants) with vendored dependencies (Flask, SocketIO, Werkzeug). The repository also contains a complete Scheme interpreter (parser, evaluator, REPL) and a SQL lab. The code is functional and demonstrates understanding of core CS concepts, but it suffers from massive duplication of editor assets (Ace editor, static files) across multiple assignment directories, vendored third-party libraries that are not centrally managed, and a lack of modularization. It is not intended for production use or external reuse, but the Scheme editor framework and the ucb.py utility module exhibit patterns that could be extracted for educational tooling.
The LLM identified 4 files worth highlighting for reuse:
A recursive-descent parser that converts Scheme source code into a structured format (FormatList, FormatAtom, FormatComment) for pretty-printing. It handles comments, dotted lists, and nested expressions. This module is self-contained and could be extracted to build a Scheme code formatter or linter for any educational Scheme environment.
Builds the global environment frame for the Scheme interpreter by registering math primitives (sin, cos, sqrt, etc.) and other built-in procedures. It demonstrates a clean pattern for populating an evaluation environment with callable objects. Reusable for any Scheme-like interpreter or DSL that needs a standard library of math functions.
A GoldenLayout component that renders an interactive environment diagram (SVG) with step controls, box-pointer toggling, and pan/zoom. It communicates with a worker thread for asynchronous updates. This pattern is reusable for any educational tool that needs to visualize nested scopes and variable bindings in real time.
A lightweight utility module providing @main (entry point decorator), @trace (function call tracer), and interact() (REPL). Used uniformly across all CS61A projects. This is a clean, self-contained module that could be extracted to bootstrap any educational Python assignment with minimal ceremony.