You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, &ore or 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 spaces.
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.any and 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.
The text was updated successfully, but these errors were encountered:
Some native functions take a keyword as an argument (e.g.
ulocate
only acceptsore
,building
,spawn
ordamaged
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:
:keyword
, e.g.:ore
, but.ore
,&ore
or any other prefix would also work.keyword(ore)
. The keyword might or might not be enclosed in spaces.keyword.ore
.Ulocate.ore
,Radar.any
and 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.
The text was updated successfully, but these errors were encountered: