Closed MysteryBlokHed closed 3 years ago
With this change the assignment operator
Changes to the language's syntax should be done in a separate PR after this issue is closed..=
should be changed to :=
, as it's already used to initialize variables in some languages.
Right now, the
tokenize()
function will look for a colon preceded by a space before attemting to turn something into a keyword, and anything else is put into a token calledNonDatabind
. There are some problems with this system. In the way it's implemented, it's impossible for a token to start with another (eg. you couldn't have:def
and:deffunc
, since it would finddef
and stop looking for new keywords). It's also impossible to make a token that doesn't begin with:
, which is pretty unusual for any language.If the tokenizer was rewritten to just treat anything separated by whitespace as a separate token, then there would be a lot more freedom as to what tokens could be named, etc. Any space-separated tokens that weren't recognized by Databind would just be assumed to be normal Minecraft commands and kept as-is. However, this is not an issue for this PR. The following:
Could be tokenized as something like:
[Token::DefineFunc, Token::FuncName("test"), Token::NewLine, Token::NonDatabind("say"), Token::NonDatabind("hi"), Token::NewLine, Token::EndFunc]
.