Post by tomxp411 on Apr 30, 2018 20:36:42 GMT
This is just a thread to gauge interest in a cross-compiler for CBM basic.
So I'm contemplating building a BASIC interpreter/compiler, similar to QuickBASIC, but that would tokenize or compile BASIC programs for the C64. (Tokenizing is better for debugging, compiling is faster.)
The general idea is this:
1. no line numbers: in the editor, you can freely move lines around, add statements, and label subroutines without the need for line numbers. GOTO and GOSUB targets would be labeled using the QuickBASIC convention:
2. structured code: IF/THEN/ELSE/ENDIF, WHILE/WEND
3. sub and function: Declare subroutines and functions and call them using standard name(argument) syntax.
4. long variable names: editor will accept any length variable name, condensing the name to 1 or 2 letters in the generated code.
5. Compact code: remove all the spaces, remarks, and other bits that don't affect execution.
6. Compile to p-code: BASIC statements are compiled to a series of machine-language instructions that call ROM routines for I/O and math functions. Arithemtic expressions, branching, and looping are compiled to native code.
7. Language extensions: I'd like to provide language shortcuts for common proceures that currently require POKE statements: screen colors, sprites, and sound functions come to mind.
These would be converted to POKE statements when tokenizing or compiling the program.
Another thing I'm toying with is a CBM BASIC interpreter for Windows; so you'd actually run CBM BASIC code directly on your deesktop, not in an emulator. In the long term, this would make a great "learning to program" environmemnt. That's how I learned, and it seems like a much more friendly starting point than Visual Studio or even Lua/Python, which isn't very good at creating interactive programs.
So I'm contemplating building a BASIC interpreter/compiler, similar to QuickBASIC, but that would tokenize or compile BASIC programs for the C64. (Tokenizing is better for debugging, compiling is faster.)
The general idea is this:
1. no line numbers: in the editor, you can freely move lines around, add statements, and label subroutines without the need for line numbers. GOTO and GOSUB targets would be labeled using the QuickBASIC convention:
2. structured code: IF/THEN/ELSE/ENDIF, WHILE/WEND
3. sub and function: Declare subroutines and functions and call them using standard name(argument) syntax.
4. long variable names: editor will accept any length variable name, condensing the name to 1 or 2 letters in the generated code.
5. Compact code: remove all the spaces, remarks, and other bits that don't affect execution.
6. Compile to p-code: BASIC statements are compiled to a series of machine-language instructions that call ROM routines for I/O and math functions. Arithemtic expressions, branching, and looping are compiled to native code.
7. Language extensions: I'd like to provide language shortcuts for common proceures that currently require POKE statements: screen colors, sprites, and sound functions come to mind.
These would be converted to POKE statements when tokenizing or compiling the program.
Another thing I'm toying with is a CBM BASIC interpreter for Windows; so you'd actually run CBM BASIC code directly on your deesktop, not in an emulator. In the long term, this would make a great "learning to program" environmemnt. That's how I learned, and it seems like a much more friendly starting point than Visual Studio or even Lua/Python, which isn't very good at creating interactive programs.