basicv2 icon indicating copy to clipboard operation
basicv2 copied to clipboard

implement extended basic

Open nippur72 opened this issue 6 years ago • 2 comments

MoSpeed already accepts labels in place of line numbers, why not extend the syntax making it recognize structured loops? It would be great to write structured BASIC and then compile down to machine language.

Just these would be enough:

  • if then else
  • do ... loop while condition / do ... loop until condition
  • while condition ... wend
  • continue
  • exit for, exit do, exit while

They can all be traslated easily into BASIC v2 statements, they are just IFs and GOTOs. The only problem is in the IF-THEN-ELSE because you have to consider the dangling else problem in your grammar.

nippur72 avatar May 10 '19 13:05 nippur72

Tempting...isn't it? I was about to do something like this a few times, but I always decided against it. I decided to keep the frontend language consistent and limited to BASIC V2 instead and to work on the backend. Mainly because I actually don't think that we need another BASIC dialect for the C64 and VIC20 that's incompatible to all the existing ones. But I'll leave this issue open as a reminder...

EgonOlsen71 avatar May 11 '19 11:05 EgonOlsen71

Instead of inventing yet another BASIC dialect maybe (partial) support for CBM BASIC 3.5 (and 7) would be a nice idea. At least the easily portable stuff to the current targets and adding C16/116/Plus 4 and C128 as targets.

Marrin avatar Sep 12 '22 21:09 Marrin