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

All aspects of programming on the Commander X16.
Post Reply
rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

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

Post 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

 

 

 






 
Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

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

Post by Scott Robison »


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

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

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

Post by rje »


Thank you.

idea1407a
Posts: 22
Joined: Sun Oct 16, 2022 6:27 pm

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

Post 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.

 

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

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

Post 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.

 

Post Reply