This commit is contained in:
2024-02-19 11:21:07 +01:00
parent de0377397f
commit e8dfb94860
34 changed files with 295 additions and 38 deletions

View File

@ -9,7 +9,7 @@ KEYWORD_TOKENS = [("KEYWORD_"+i.upper(), i) for i in [
"maybe",
"do",
"if",
"because",
# "because",
"until",
"define",
"as",
@ -19,18 +19,21 @@ KEYWORD_TOKENS = [("KEYWORD_"+i.upper(), i) for i in [
]]
BUILTIN_TOKENS = [("BUILTIN", i) for i in [
"print"
"print",
"input",
"random"
]]
DATA_TOKENS = [
("DATA_STRING", r"\'.*?\'"),
("DATA_NUMERAL", r"\d+(\.\d+)?")
("DATA_INT", r"\d+"),
("DATA_FLOAT", r"\d+(\.\d+)")
]
SYMBOL_TOKENS = [
("SYMBOL_SET", r"\-\>"),
("SYMBOL_LPARENS", r"\("),
("SYMBOL_RPARENS", r"\)"),
# ("SYMBOL_LPARENS", r"\("),
# ("SYMBOL_RPARENS", r"\)"),
("SYMBOL_LBRACKET", r"\["),
("SYMBOL_RBRACKET", r"\]"),
("SYMBOL_LCURL", r"\{"),
@ -39,8 +42,8 @@ SYMBOL_TOKENS = [
("SYMBOL_MINUS", r"\-"),
("SYMBOL_TIMES", r"\*"),
("SYMBOL_DIVIDE", r"\/"),
("SYMBOL_COMMA", r"\,"),
("SYMBOL_COLON", r"\:"),
# ("SYMBOL_COMMA", r"\,"),
# ("SYMBOL_COLON", r"\:"),
("SYMBOL_SEMICOLON", r"\;"),
("SYMBOL_PIPE", r"\|"),
("SYMBOL_QUOTE", r"\""),