Input | Output |
About
This tiny app transforms QBASIC-like sources to regular BASIC.
Supported features:
- auto line numbering (starting at 10),
- labels and targets in square brackets (“
[…]
”)
(only one leading label per line allowed), - apostrophe-comments (single quotes, “
'…
”) will be replaced by regularREM
statements
(a colon will be inserted, as needed).
Any REM statements or strings are ignored. Any bare labels at the end that are used as a target will result in an additional END
statement.
The transformation is case-agnostic, the case of any inserted REM
commands will be determined heuristically.
Example:
the source text
'test [label] print "hello world "; goto [label]
will be transformed to
10 rem test 20 print "hello world "; 30 goto 20
Compatibility: This should work with any dialect that doesn’t use single quotes in normal program text, other than for comments, and that doesn’t use square brackets for syntax. In order to work with BBC BASIC-like inline assembly, any unclosed square brackets outside of the immediate context of a jump statement will trigger merely a warning, but the transformation will still succeed.
REMarks are assumed to extend to the end of the respective line.
Note on mixed format sources: Any lines with line numbers will be renumbered in the order they occur in the text. Any numeric jump targets immediately following “GOTO
”, “GO TO
”, or “GOSUB
” which point to a known line number will be updated accordingly. Unknown numeric targets will be preserved as-is. (Line numbers and jump targets may contain white space.)
(This is generally the same implementation as built-in into the PET 2001 emulator.)