Program Lexer v6
Program Lexer v6
Implement a lexer for the v6 language (modules + type annotations).
Function signature
func Lex(src string) ([]Token, error)
New token
->should be tokenized asARROW.
The rest of the tokens are the same as v5:
- keywords:
let,var,const,fn,if,else,while,for,return,break,continue,module,import,export,as,true,false,nil - identifiers, numbers, strings
- operators and punctuation
Notes
- Type names (
number,bool,string,array,map) are lexed as identifiers. - Prefer readability over cleverness.
Run tests to see results
No issues detected