Specifying mlog keywords in fucntion calls
Some native functions take a keyword as an argument (e.g. ulocate only accepts ore, building, spawn or damaged as first argument). Current Mindcode syntax doesn't distinguish between such a keyword and an identifier - indeed, these "mlog keywords" aren't even defined as keywords.
Up to now, some hacks were applied in the compiler to get around the issue, but introducing arrays (and variable types down the line) complicates the issue even more. I therefore want to distinguish between mlog keywords and identifiers in the syntax. So far I've come with these possibilities:
- Define some specific syntax for keywords. I'm currently leaning towards
:keyword, e.g.:ore, but.ore,&oreor any other prefix would also work. - Have a special function turning an identifier into a keyword:
keyword(ore). The keyword might or might not be enclosed in quotes. - Create a common enum-style data type and make all keywords be part of it:
keyword.ore. - Create a separate keyword enum for each type, e.g.
Ulocate.ore,Radar.anyand so on.
The last point makes things more organized, but needs to be maintained, and would require yet another mechanism for supporting custom instructions, so I'll probably won't go that way.