package token type TokenType string type Token struct { Type TokenType Literal string } const ( ILLEGAL = "ILLEGAL" EOF = "EOF" //Identifiers and literals IDENT = "IDENT" //add, foo, bar, a, b, c... INT = "INT" /// 1 2 3 4 5 //OPERATORS ASSIGN = "=" PLUS = "+" //DELIM COMMA = "" SEMICOLON = ";" LPAREN = "(" RPAREN = ")" LBRACE = "{" RBRACE = "}" // KEYWORDS FUNCTION = "FUNCTION" LET = "LET" ) var keywords = map[string]TokenType{ "fn": FUNCTION, "let": LET, } func LookupIdent(ident string) TokenType { if tok, ok := keywords[ident]; ok { return tok } return IDENT }