EgonOlsen71 / basicv2

A Commodore (CBM) BASIC V2 interpreter/compiler written in Java
https://egonolsen71.github.io/basicv2/
The Unlicense
84 stars 15 forks source link

implement extended basic #30

Closed nippur72 closed 1 year ago

nippur72 commented 5 years ago

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:

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.

EgonOlsen71 commented 5 years ago

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...

Marrin commented 1 year ago

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.