Giter Club home page Giter Club logo

basicode-interpreter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

basicode-interpreter's Issues

Split core interpreter from online app

Core interpreter should produce screen, run program stored in script

Listing screen, printer, floppy visualisation, drag & drop functionality should move to online app

Accept commas on multiple `INPUT`

INPUT A,B,C - not correct BASICODE but occurs in some programs. This would be expected to accept 1,2,3 rather than 1 <Enter> 2 <Enter> 3 <Enter>

If you backspace over the INPUT prompt "? " and enter text it hangs or throws a JS exception

If you backspace over the INPUT prompt "? " and enter text it hangs or throws a JS exception. Run the test program below and press BACKSPACE once and then e.g. P and Enter; the browser tab hangs after a while. If you delete more before entering text, you get: "EXCEPTION RangeError: Invalid string length". I think it would be better if backing over the prompt was disallowed (as it is in your pcbasic) or it didn't hang or threw an exception, but instead sent the typed characters and ignored more backspaces than was needed. Now there is a great risk that a user hangs a program that they have worked with, to get a result, for a long time.
2022-02-06-001601_710x904_scrot

1000 A=100: GOTO 20: REM INPUT TEST
1010 INPUT "ENTER A STRING";A$
1020 PRINT "THE STRING IS: ";A$
1030 GOTO 1010
30000 REM DEMONSTRATES A BUG IN INPUT
30010 REM ENTER BACKSPACE AND A CHARACTER AND ENTER: IT HANGS.
30030 REM ENTER SEVERAL BACKSPACES AND A CHARACTER: A JS EXCEPTION.
30040 REM WHAT I EXPECTED: EITHER THAT BACKSPACE WOULDN'T BACK
30050 REM OVER THE PROMPT "? ", OR THAT IT WOULD ACCEPT THE TYPED
30060 REM CHARACTERS AS INPUT.

I use Chromium Version 92.0.4515.98 (Official Build) Built on Raspbian , running on Raspbian 10 (32-bit), on Raspberry Pi 4 B 8 GiB.

Crash on re-running after syntax error

TypeError: Cannot read property 'width' of undefined
at Program.subClear (basicode.js:2850)
at Node.evaluate (basicode.js:1456)
at Node.step (basicode.js:1461)
at step (basicode.js:4034)

Various/Boekhoudprogramma line 1880

Keywords inside variable names should be recognised

BASICODE follows Spectrum/C64 etc convention that a keyword anywhere is recognised - so IFA=WTHEN100 is acceptable. The interpreter currently only recognises keywords at the start of an alpha string, i.e. IFA is recognised as IF A but the keyword in WTHEN is not recognised.
(In practice this matters little as a space is usually used to separate the latter case)

Break key toggle not working?

See SAMMELSURIUM/JOURNALE/STOP - we should be able to toggle the break key on and off but it appears disables throughout the program.

Stop button has blue symbol on mobile

For some reason, the stop symbol becomes bright blue and the button slightly higher, whereas the play symbol is grey as usual. This may have something to do with touchscreen-specific css?

BASICODE-3C CN implemented incorrectly

additional CN return value occurs in GOSUB 220, not GOSUB 200(see journal inBASC-3C.ASC). Value is such that CHR$(CN+IN) reproduces the screen character case sensitively.

It is easy to accidentally hit Break

It is too easy to accidentally hit Break when e.g. trying to hit Delete/Backspace on the screen keyboard. Maybe it could be changed to Shift+Break in order to stop. It would also be good if you could continue after break, by pressing the Break key again or typing CONT and Enter.
Screenshot_20220206-054228

crash on READing numeric data into string

READ A$: PRINT ASC(A$): DATA 2

no type checks mean a number is read into string var, then crash onASC. Program likely expects 2 to be read as "2" (incorrect per spec but usual MS BASIC behaviour)

see VIC on VC8

Accept GOSUB 20

A program with GOSUB 20 instead of the (correct) GOTO 20 would function correctly, simply running the whole program as a big subroutine and terminating before the matching RETURN. E.g. in VC8, track 16 "English".

Feature request: Strict mode

Hi!

I was using the basicode-interpreter to develop a BASICODE program. For this use-case it is really handy, but there is a major pitfall: it's very easy to write code which does not satisfy the requirements of correct BASICODE and therefore will not run correctly when loaded into other interpreters.

I propose the addition of an optional strict mode, which issues syntax or runtime errors for non-conformant code.

Examples include the 60 character limit on lines and the variable naming restrictions mentioned in the BASICODE documentation.

Another issue I personally hit is that the interpreter returns the bitwise result for AND and OR. Unfortunately, that behavior should not be relied on in BASICODE, where only logical AND and OR should be assumed. (For example, 2 AND 1 on a ZX Spectrum is 2.)

Thanks again for your awesome work!

State persistance issue (FF)

Problem:
If program hangs interpreter in Firefox, after stopping the js script and refreshing the tab, the interpreter will autorun the bad program (even if you paste the url of the interpreter in another tab). And this continues after restarting the browser.

What should happen:
The interpreter shouldn't autorun the program (on refresh / restart of the browser / pasting interpreter url in another tab). Or it should load the demo program instead of auto-executing the custom code.

Bypass:
Switching HTTP protocol (from ex. http to https) allows you to run new instance of interpreter. Side note: under https, the tape storage doesn't work (tape list doesn't show).

Code that hangs the script (in the last 3 lines I didn't add "10" to the line numbers in THEN and GOTO):

1000 A=100:GOTO20
1010 LET W=500:DIM F(W):LET P=1:LET A=3
1020 LET F(P)=A:LET P=P+1:IF P>W THEN GOTO 950
1030 LET A=A+2:LET X=1
1040 LET S=A/F(X):IF S=INT(S) THEN 30
1050 LET X=X+1:IF X<P AND F(X)*F(X)<=A THEN 40
1060 GOTO 20

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.