For counter [As datatype] = start To | DownTo end [Step value]
Next
and most likely
While condition
Wend
but how many use these (and do you prefer any over While/Wend)?
Do
Loop
or
Do Until Condtion
Loop
or my least favorite
Do
Loop Until Conditon
are there any other (excluding For Each) that I missed?
Am trying to insure my Swift translator supports the majority of terms. The problem I would have with the last two, is the Swift equivalent has the condition on the “loop” statement… meaning I’d have to do a look ahead to determine where that is in a possiblly nested structure.
“Was” a Basic thing. Now Dim is going dead and Var is coming in, so Xojo is changing, and selling itself as something “not BASIC”, and could fix such inconsistencies on the way.
Yeah… that might work. I can translate the first situation on the fly without needing to look ahead… the 2nd might take a bit more as it needs to know if the DO needs to change to REPEAT… as it would be left as DO, if the “loop” had no condition (ie. infinitie)
yeah I can see the difficulty … short of creating a full abstract syntax tree that represents the code that you could then do various transforms on I dunno how else you do it
Well I have a plan… its rather “brute force”… but basically entails building a dictionary of where every DO and LOOP statement is ( there is now a stack structure that insures that every loop structure has a proper ending structure etc)… then once it knows where the start and end of each loop resides it can analyze to determine which of the syntax structures it needs to be transformed to.
Another thing that needs to be done, is for the EXIT command, Swift may need to have LABELS inserted to support the “named break” structure… this same dictionary will support the ability to do this as well