From 81499f10a983bded055029af258084976774910c Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Wed, 12 Oct 2022 21:09:58 +0300 Subject: Expand on token storage --- website/content/slides/02_lexical_analysis/_index.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/website/content/slides/02_lexical_analysis/_index.md b/website/content/slides/02_lexical_analysis/_index.md index 3caa107..da69d31 100644 --- a/website/content/slides/02_lexical_analysis/_index.md +++ b/website/content/slides/02_lexical_analysis/_index.md @@ -111,11 +111,19 @@ Typical tokens are: --- ### double + string ~ wasteful -- `std::variant *C++17* -- tokens can just keep strings and leave the parser to turn them into numbers +The token is either a string or a number, but we are keeping both, so it is +somewhat wasteful. +--- +#### Keeping data in token + +1. `std::variant *C++17* + - this means we have to keep the contents of the source alive as long as + any token is still alive +4. tokens can just keep strings and leave the parser to turn them into numbers --- ## Lexer -- cgit v1.3.1-26-gb76a