Chapter 1: Setting Up the Frontend
Build the HTML, CSS, and JavaScript skeleton for the truth table calculator - input handling, operator display, and UI wiring.
A step-by-step series on building a truth table generator that computes Conjunctive and Disjunctive Normal Forms from scratch using vanilla JavaScript.
In this series we build a truth table generator that takes a boolean logic expression, parses it, evaluates every possible variable assignment, and produces both the Conjunctive Normal Form (CNF) and Disjunctive Normal Form (DNF) - all from scratch in vanilla JavaScript.
You can try the finished calculator here: Truth Table, CNF & DNF Generator, and the full source code is available on GitHub.
The series is structured as follows:
(A & B) -> C into a stream of tokens.By the end you will understand the full pipeline from user input to truth table and normal forms, and have the mathematical foundation to back it up.
Build the HTML, CSS, and JavaScript skeleton for the truth table calculator - input handling, operator display, and UI wiring.
Build a tokenizer that converts a raw boolean expression string into a structured array of tokens - the first step in our parsing pipeline.
Build a recursive descent parser that transforms a token stream into an Abstract Syntax Tree, respecting operator precedence.
Evaluate the AST across all variable assignments to build a truth table, then extract Conjunctive and Disjunctive Normal Forms.
Formal definitions and proofs for propositional logic, DNF/CNF existence, and key logical equivalences.