Page 1 of 1

New community dev tool uploaded: BASIC Pre-processor in Perl

Posted: Thu Apr 22, 2021 8:16 pm
by rje



BASIC Pre-processor in Perl




View File






Scott's dev tool prompted me to post this one.



This is a dev tool for people who write things in BASIC, but write it off-board, and like to have some more modern features. 



This script runs best on a UNIX or (perhaps) a Windows environment.

It supports

(1) Labels.

(2) Long variables.

(3) Multiple source files.

(4) "Ephemeral" comments.



Your source files must not use line numbers.  This script will create them for you.

Labels look like C64 LIST's:

 

{:this is a label}
goto {:this is a label}

Long variables are actually namespaces that work for strings, floats, or ints.  They can have periods in them, so they can even vaguely resemble object field accessors. Declare and use them like this:

longvar \thing.entry

\thing.entry$ = "the thing!"
\thing.entry = 5.0

 



Ephemeral comments start a line with a semicolon.  Their entire content is ignored and thrown away when the output BASIC source is built.  I think it's useful for development documentation that's not needed in the target BASIC 2.0 code.


;
;   This comment will never show up in the target code.
;


This invokes the script, passes in files 1...n  (however many you have), and redirects STDOUT to a target file (here, output-file.bas).  That output file is ASCII source, and is directly loadable into the emulator via the -bas flag.  

 

perl basic-labelmaster.pl file1.list file2.list ... filen.list > output-file.bas

 

 

 






 

New community dev tool uploaded: BASIC Pre-processor in Perl

Posted: Thu Apr 22, 2021 11:49 pm
by Scott Robison

I think it was Scott's dev tool. Our last names are similar. ?


New community dev tool uploaded: BASIC Pre-processor in Perl

Posted: Fri Apr 23, 2021 2:49 am
by rje

Thank you.


New community dev tool uploaded: BASIC Pre-processor in Perl

Posted: Tue Oct 25, 2022 6:36 pm
by idea1407a

Hey, I downloaded this, but got an error in Perl. I'm running Perl 5.34 on Debian 11. The error I got was as follows:

\C no longer supported in regex; marked by <-- HERE in m/^\ <-- HERE CLS\(\)/ at basic-labelmaster.pl line 96.

 


New community dev tool uploaded: BASIC Pre-processor in Perl

Posted: Thu Oct 27, 2022 4:48 am
by rje

That's interesting.  I wonder what it's thinking it's matching in Debian?  

You can comment out that line (just insert a # sign at column 1) and the script won't suffer.

For that matter, you can comment out lines 96, 97, 98, 99, and 100.  Those are all semi-macros that I was playing with that just don't really matter.