Finite Automata and the Regex Engine
This course is where computer science stops asking "how do we build it?" and starts asking "what can be built at all?" — and it begins with the simplest possible model of computat…
Theory of Computation covers: Finite Automata and the Regex Engine, The Limits of Regular Languages, Context-Free Grammars and Parsing, Turing Machines and Undecidability, Complexity Classes and NP-Completeness. Year 2, Quarter 8. Includes 12 exercises and 3 projects.
This course unlocks once you've finished its prerequisite. Open prerequisite →
This course is where computer science stops asking "how do we build it?" and starts asking "what can be built at all?" — and it begins with the simplest possible model of computat…
The last lesson showed that regexes are exactly as powerful as finite automata. This lesson shows you the ceiling of that power — and it's lower than you'd think. There are dead-s…
Last lesson ended on a limit: finite automata can't handle nesting, so regexes can't parse HTML, arithmetic expressions, or any structure with arbitrary depth. This lesson is the …
Here is a result that will change how you think about problems forever: there are questions no computer can ever answer — not because we lack the hardware or haven't found the alg…
The last lesson was about what computers can't do at all. This one is about what they can't do efficiently — and it's arguably even more practically useful, because you'll meet th…
- [ ] Draw DFAs for: strings ending in "01", even number of 0s, divisible by 3 in binary — 3 DFA exercises - [ ] Convert an NFA to DFA using subset construction — Given a 4-state …
- [ ] Prove a language is not regular using the Pumping Lemma — {a^n b^n | n >= 0} — Classic proof - [ ] Design a PDA for {a^n b^n | n >= 0} — Push a's, pop on b's, accept if stac…
- [ ] Reduce Halting Problem to prove another language is undecidable — e.g., "does TM accept empty string?" - [ ] Prove 3-COLOR is NP-complete by reduction from 3-SAT — Polynomia…
- [ ] Build a regex engine in Ruby from scratch — Parse regex to NFA (Thompson's construction), convert NFA to DFA (subset construction), simulate DFA on input strings; support .,…
Parse a regex pattern into an NFA (Thompson's construction), optionally convert to DFA (subset construction), and match input strings. Support ., , +, ?, |, and (). No Ruby Regexp…
Build a Turing machine simulator in Ruby. Define machines with states, alphabet, transition function. Simulate execution step-by-step with tape visualization. Include 3 example ma…
Implement a WAL that logs every write operation to a sequential file before applying it. On crash recovery (simulate by killing the process), replay the log to restore state. This…
- [ ] What is a DFA? How does it differ from an NFA? Are they equivalent in power? - [ ] What is the Pumping Lemma for regular languages? How do you use it to prove a language is …
- [ ] Course 8.1 knowledge check passed - [ ] Course 8.2 knowledge check passed - [ ] Mini Database Engine capstone completed
Complete all of the following:
15 lessons. Read in order; spiral back when you need to. By the end you'll have used the core ideas twice — once on the abstract, once on something you'll meet at work next week.