GSC Interpreter
A Turing-complete interpreter developed for a compiler course
Loading...
Searching...
No Matches
scanner.hpp File Reference
#include "token.hpp"
#include <map>
#include <string_view>
#include <vector>
Include dependency graph for scanner.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Scanner
 Lexical analyzer for the GSC programming language. More...
 

Variables

static const std::map< std::string_view, TokenTypekeywords
 

Variable Documentation

◆ keywords

const std::map<std::string_view, TokenType> keywords
static
Initial value:
= {
{"and", TokenType::AND}, {"or", TokenType::OR},
{"if", TokenType::IF}, {"else", TokenType::ELSE},
{"true", TokenType::TRUE}, {"false", TokenType::FALSE},
{"for", TokenType::FOR}, {"while", TokenType::WHILE},
{"nil", TokenType::NIL}, {"print", TokenType::PRINT},
{"var", TokenType::VAR}}
@ IF
Definition tokenType.hpp:40
@ WHILE
Definition tokenType.hpp:45
@ NIL
Definition tokenType.hpp:46
@ AND
Definition tokenType.hpp:38
@ ELSE
Definition tokenType.hpp:41
@ OR
Definition tokenType.hpp:39
@ FALSE
Definition tokenType.hpp:43
@ FOR
Definition tokenType.hpp:44
@ TRUE
Definition tokenType.hpp:42
@ PRINT
Definition tokenType.hpp:47
@ VAR
Definition tokenType.hpp:48

Definition at line 8 of file scanner.hpp.

8 {
9 {"and", TokenType::AND}, {"or", TokenType::OR},
10 {"if", TokenType::IF}, {"else", TokenType::ELSE},
11 {"true", TokenType::TRUE}, {"false", TokenType::FALSE},
12 {"for", TokenType::FOR}, {"while", TokenType::WHILE},
13 {"nil", TokenType::NIL}, {"print", TokenType::PRINT},
14 {"var", TokenType::VAR}};