Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: A BASIC interpreter to run StarTrek

by cavac (Parson)
on Aug 11, 2021 at 14:03 UTC ( [id://11135787]=note: print w/replies, xml ) Need Help??


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+(.*)/;

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

Replies are listed 'Best First'.
Re^2: A BASIC interpreter to run StarTrek
by GrandFather (Saint) on Aug 11, 2021 at 21:28 UTC
    Seems you developed this on Windows

    Guilty as charged. Usually I'd at least have gotten the file name case consistent, but it was a few minutes past bed time and I created the node in a bit of a rush. Sorry about that. Fixed now along with the line ending issue.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135787]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-03-29 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found