From e94f43ab2710913919d0115399ea2b67974259c8 Mon Sep 17 00:00:00 2001 From: sfja Date: Thu, 24 Oct 2024 23:47:16 +0200 Subject: [PATCH] Fixes in chapter 1 --- compiler/chapter_1.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/compiler/chapter_1.md b/compiler/chapter_1.md index 564738a..ef8d715 100644 --- a/compiler/chapter_1.md +++ b/compiler/chapter_1.md @@ -170,18 +170,24 @@ Using some if-statement and loops, this implementation goes through each `i` cha A visualization of how this code would lex the expression `+ 12 34` could look like this: ``` -text i state tokens +text i state tokens -+ 12 0 make Plus [] ++ 12 34 0 make Plus [] ^ -+ 12 1 skip whitespace [Plus] ++ 12 34 1 skip whitespace [Plus] ^ -+ 12 2 make Int [Plus] ++ 12 34 2 make Int [Plus] ^ -+ 12 3 make Int [Plus] ++ 12 34 3 make Int [Plus] ^ -+ 12 4 done [Plus Int(12)] ++ 12 34 4 skip whitespace [Plus Int(12)] ^ ++ 12 34 5 make Int [Plus Int(12)] + ^ ++ 12 34 6 make Int [Plus Int(12)] + ^ ++ 12 34 7 done [Plus Int(12) Int(34)] + ^ ``` #### Exercises