However, in lieu of a new language, I figured it would be easy enough to add some of those features via a "translator". You would still code with BASIC, but without line numbers and such, then the translator would trim out spaces and remarks, add the line numbers, and spit out the code to copy and paste into Classic99.
I wrote the guts of it last night with these features:
* No line numbers allowed, they will be assigned
* Labels can consist of A-Z, a-z, 0-9, _, and -. They can be any length, but a maximum line length is 256 characters. Label "definitions" must start a line and end with a single colon. Labels can be referenced any place a line number can be used, currently: THEN, ELSE, [ON]GOTO, [ON]GOSUB, and ON ERROR.
* Comments are stripped from the code. Comments are any line that start with REM or // (C/C++ style single line comment notation). XB also has a "trailing comment" designated by a ! that causes the rest of the line to be ignored. These comments will be stripped as well.
* Leading space is ignored so you can indent as much as you like.
* Long lines can be split by ending a line with .. (two consecutive periods). These lines will be joined into one long line and the XB limit of 140 characters will be checked.
* Starting line numbers and the increment can be set.
Features I was thinking of adding:
* Support multiple source files.
Currently the translator is written in PHP, which makes it conducive to being set up on a webpage. However, that might make development cumbersome, so I was thinking of making it a native Windows app. I'd like to hear opinions either way.
This post will always have the latest code.
CHANGE LOG: V1.0 November 20, 2010 * Initial release V1.1 February 13, 2011 * Added forced line number override. * Fixed label bug. * Fixed max line number bug. * Change REM statements to be included in output code. V1.2 February 25, 2011 * Added the missing RESTORE, BREAK, and UNBREAK commands / statements to the list of tokens that support a line number or list of line numbers. V1.3 Feb 26, 2011 * Fixed REM and ! comments. V2.0 March 16, 2015 * Fixed using RETURN in an error context when used in an IF/THEN/ELSE statement, i.e. IF exp THEN RETURN <label>. * Added additional support for the other ON <statement> (BREAK, ERROR, etc.) commands that can accept a line-number list. * Added a version number to keep track of updates. * Added a readme.txt with instructions on how to use TidBit on the command line or with PHP's built-in web server. * Removed requirement to have .. after the XB :: operator * Added ENDIF pseudo statement V2.1 June 25, 2016 * Removed requirement to have .. after THEN or ELSE statements, or after the last expression before an ELSE statement. * Prevent the keyword 'PRINT' from being used as a label to avoid possible errors due to the BASIC use of the colon with a print statement: 'PRINT: :' V2.2 September 10, 2016 * Added more debug statements. * Added check to not allow the auto line number from being overwritten by a forced line number if the forced line number is less than the current auto line number. This prevents accidental loss of code. V3.0 September 13, 2016 * Simplified parser stage. Being less-smart reduces errors. * Added list of reserved words to avoid label confusion. * Fixed bugs in expression parsing with embedded strings. * Fixed string parsing bug with escaped double quotes. * Fixed XB ! comments that were along on a line. * Fixed XB :: operator when following PRINT or DISPLAY AT with colon options.
Edited by matthew180, Tue Sep 13, 2016 9:48 PM.