Code Monkey home page Code Monkey logo

bababasic's People

Contributors

ianatha avatar sweep-ai[bot] avatar

Stargazers

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

Watchers

 avatar

bababasic's Issues

IF...THEN...ELSE blocks don't seem to work

My code:

PRINT "What is your name, adventurer?"
INPUT "> "; name$
PRINT "Greetings, "; name$; "!"
IF name$ = "Byron" THEN
	PRINT "Welcome, Byron, the greatest hero of all time!"
ELSE
	PRINT "Greetings, "; name$; ". Not the hero I was expecting, but I guess you'll do."
END IF

I get an error about no viable alternative, as shown in the screenshot provided.
Screenshot_20240405-155352

empty lines cause interpreter errors

The following script, due to addition of an empty line at the end, fails.

10 A = 1
20 PRINT A

The error is:

REM --- OUTPUT START
REM !!! SYNTAX ERROR: Cannot mix linenumber and no-linenumber mode!
REM --- OUTPUT END

Support file operations

Script:

OPEN "DATA.DAT" FOR OUTPUT AS #1

Error:
Screenshot 2023-11-04 at 2 47 41 AM

Fixing this would require somehow "mounting" an Android FS location onto the app, or something of the sort.

There are some decisions to be made as to if paths like "C:\IANDIR\FILE.TXT" should work, or if we should expect POSIX/Android paths.

do not lose buffer on restart

The app always displays sample.txt whenever it starts/restarts.
It should remember the buffer of an unsaved file.

script output should be separate from script buffer

Currently, we output the stdout and stderr of the running script into the script editor's buffer, and we prepend "REM", to make it comments.

This was a cute hack to get this rolling quickly, but something nicer needs to happen.

code fails silently

The following code fails silently:

10 REM 29-10-2023
20 DIM A(2)
30 A(0)=6:A(1)=A(0)+11
35 A(2)=A(1)+10
40 FOR I%=1 TO 2
50 PRINT "A(",I%,")=",A(I%)
60 NEXT I%

The output was:

REM --- OUTPUT START
REM --- OUTPUT END

Implement NAME statement

We should implement the QBasic "NAME" statement, which changes the name of a disk file or directory.

Its syntax is "NAME oldfilename AS newfilename".

The NAME statement is similar to the DOS RENAME command. NAME can move a file from one directory to another but cannot move a directory.

The arguments oldfilename and newfilename are string expressions each of which contains a file or directory name and an optional path. If the path in newfilename is different from the path in oldfilename, the NAME statement changes the pathname as well as renames the file as indicated.

Examples

NAME "ACCTS" AS "LEDGER"

In principle, resolving this is very similar to implementing the KILL statement in #96. Specifically, the skeleton for declaring a new QBasic statement is the same, but instead of deleting the file (like KILL does), we must rename it.

The relevant files to change are:

  • libbababasic/src/main/antlr/io/atha/libbababasic/grammar/BabaBASIC.g4
  • libbababasic/src/main/java/io/atha/libbababasic/file/BBFiles.kt
  • libbababasic/src/main/java/io/atha/libbababasic/parser/IR.kt
  • libbababasic/src/main/java/io/atha/libbababasic/parser/IRListener.kt
  • libbababasic/src/main/java/io/atha/libbababasic/runtime/BBRuntime.kt
  • libbababasic/src/main/java/io/atha/libbababasic/runtime/Functions.kt

SLEEP in QB is implemented differently

SLEEP's argument should be in seconds, not milliseconds.
Furthermore, SLEEP should be interruptible by pressing any key.
(Check the behavior of SLEEP 0)

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.