Spaces!
Posted: Fri Mar 24, 2017 1:33 pm
As many correspondents do, I would like to thank Mike for his sterling efforts in producing ESPbasic thus far. Given the amount of work it must entail, one is hesitant to criticise, but....
One of the recurring problems with the syntax relates to spaces - and whether they should be there or not.
Earlier threads have already pointed out that the space in front of an "=" sign is essential. The space following, however, is not.
Yesterday I was working with file read and write, and it didn't want to play. After some frustration, it seems that write ({filename}, [data$}) does NOT work - however, write({filename}, [data$}) works fine. In other words, in this case you must NOT put a space before the opening parenthesis.
I seem to remember reading about another command recently where it was stated that a space must not be present. All this is very confusing.
I certainly don't have the necessary knowledge to write a compiler, but I have had to implement parsing in many programs in the past. One of the earliest stages was always to remove ALL spaces, except those occurring between quotes - ie strings. That way, whether a space was present or not was irrelevant.
If this is impracticable, then could we at least have some consistency? - either we ALWAYS need a space separating parts of a command or function, or we NEVER need a space in there. This would save me a lot of time!
Phil
One of the recurring problems with the syntax relates to spaces - and whether they should be there or not.
Earlier threads have already pointed out that the space in front of an "=" sign is essential. The space following, however, is not.
Yesterday I was working with file read and write, and it didn't want to play. After some frustration, it seems that write ({filename}, [data$}) does NOT work - however, write({filename}, [data$}) works fine. In other words, in this case you must NOT put a space before the opening parenthesis.
I seem to remember reading about another command recently where it was stated that a space must not be present. All this is very confusing.
I certainly don't have the necessary knowledge to write a compiler, but I have had to implement parsing in many programs in the past. One of the earliest stages was always to remove ALL spaces, except those occurring between quotes - ie strings. That way, whether a space was present or not was irrelevant.
If this is impracticable, then could we at least have some consistency? - either we ALWAYS need a space separating parts of a command or function, or we NEVER need a space in there. This would save me a lot of time!
Phil