The last statement the parser needs is INSERT, and then it can read a whole script. Today you parse INSERT INTO ... VALUES and split a multi-statement string on semicolons.
Parse an INSERT statement into a node holding the table and value list, and parse a semicolon-separated script into a list of statements.
INSERT INTO users VALUES (1, 'alice') completes the core statement set. Its
value list is a parenthesized, comma-separated run of expressions - reuse the
atom parser from lesson 16, so a value can be any literal - stored on an Insert
node beside the table name. Parsing statements now means peeking at the leading
keyword (SELECT, CREATE, INSERT) and dispatching to the matching rule.
The demo ties the chapter off: parse a script. Given several statements
separated by semicolons, parse one, expect the semicolon, and repeat until EOF,
collecting a list of statement nodes. That list is precisely what the executor
will loop over next chapter - one parsed statement at a time, run in order. The
front-end is done; time to make these trees do something.
type InsertStmt struct { Table string; Values []Expr }// expect(INSERT INTO) name (VALUES) LParen expr-list RParen// ParseScript: parse a statement, expect Semicolon, repeat until EOF