I've recoded the script completely to parse and output as a tokenized PRG.
I'm also planning to add inline ASM directives to use BASIC, but enabling the option to optimize parts of the program - this will be an experimental feature ?
------------------------------
Hey all,
My retro programming background is more Qbasic than BASIC, so for me getting used to the first 2 characters only being used for variables was quite painful for me. I'm also not a fan of using line numbers, and would prefer to use subroutines as with Qbasic.
I created a script (which I'll no doubt continue to develop) which converts Qbasic style code into BASIC with line numbers (please see screenshots)
The BASIC output isn't pretty, and I may work on that at some stage.
Features:
@LABEL: Create labels using @LABEL: - this will be automatically converted to a line number, and anywhere in the code that references @LABEL will be converted to the line number
Variable names: can use alphanumeric characters with underscore (I know not valid in Qbasic). Script will convert variable names to a unique 2 letter variable. This eliminates the worry of having to chose your variable names.
Line numbers: automatically added in and whitspaces / blank lines are removed
Comments: Qbasic style comments with single quote '
Planning to add in sub routines which auto handle variables.
Actually quite interested, but X16 team is planning to make similar tool built-in.
But for the time being, it's good to have third party option already.
I would wish to have some control over generated variable names, so the generated code would be more readable. But I don't have good ideas on how to implement this.
Actually quite interested, but X16 team is planning to make similar tool built-in.
But for the time being, it's good to have third party option already.
I would wish to have some control over generated variable names, so the generated code would be more readable. But I don't have good ideas on how to implement this.
OK cool, I'll clean it up and put it on github.
The exported variables could be the 2 unique letters followed by the original name?
Just a thought on the variable names, there are some rules about not being able to use keywords inside them, like: BTNCOLOR - has COLOR in it, so BASIC will throw an error.
Brilliant minds think alike... I've been using my own, primitive "transpiler", which lets me use labels, long var names, multiple files, and eschew line numbers.
I too prefer a QBASIC-type experience. Did anyone else ever use Petit Computer for the Nintendo DS? It uses a BASIC called "SmileBASIC" which was also very QBASIC-like: automatically numbered lines for reporting errors (take that, Microsoft VBA) , but @LABELS for branching. 'Comments with a single-quote. I remember thinking "typing on this tiny on-screen keyboard with the DS stylus is really annoying, but this flavor of BASIC is really convenient!"
I think once you get used to automatic line numbering, it's hard to go back to typing them manually.
11 hours ago, Cyber said:
X16 team is planning to make similar tool built-in.
Wow, I hadn't heard that, I think that's great news.
Brilliant minds think alike... I've been using my own, primitive "transpiler", which lets me use labels, long var names, multiple files, and eschew line numbers.
awesome! ? my next step is to implement an include statement, like you said, for multiple files. Perhaps a C style #define directive could be good to reduce variable usage.
X16 team is planning to make similar tool built-in.
Wow, I hadn't heard that, I think that's great news.
David said in his video that he was impressed with BASIC editor on Maximite computer, and wants to implement similar editor on X16.
Later in Facebook group Lorin mentioned that this editor will have labels instead of line numbers, but under the hood it will generate code with line numbers, converting labels to numbers. Pretty much the same approach as in Nate's transpiler in this thread.
Besides this info, I hadn't heard anything else yet.