in reply to A BASIC interpreter to run StarTrek
Cool!
A few things: Seems you developed this on Windows. Other OS are case sensitive regarding the filesystem, so the correct filename to save the BASIC program would is StarTrek.bas (note the uppercase letters).
Another thing: Perl uses "native" line endings by default. I had to convert the bas file to Unix line endings for the interpreter to work for the first test.
Here's a simple patch that should make this work on Linux and possibly also on Mac:
diff -u basicinterpreter.pl basicinterpreter_fixed.pl --- basicinterpreter.pl 2021-08-11 15:51:20.359658237 +0200 +++ basicinterpreter_fixed.pl 2021-08-11 16:01:08.724748447 +0200 @@ -28,6 +28,8 @@ while (<$fIn>) { chomp; + s/\r//g; + s/\n//g; next if /^#/; my ($lineNum, $line) = /^(\d+)\s+(.*)/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A BASIC interpreter to run StarTrek
by GrandFather (Saint) on Aug 11, 2021 at 21:28 UTC |