Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for BASIC dialects #22

Open
cactysman opened this issue Sep 20, 2018 · 4 comments
Open

Support for BASIC dialects #22

cactysman opened this issue Sep 20, 2018 · 4 comments
Assignees

Comments

@cactysman
Copy link
Collaborator

cactysman commented Sep 20, 2018

I'm not experienced with BASIC, but QBASIC and GWBASIC seem to be dialects of BASIC with diverging functionality.

Maybe it would be wise to modularize the dialect specific code and make it two separate functions to allow explicitly running BASIC using the .Basic() function and e.g. QBASIC using .QBasic()

   var basic = require('wwwbasic')
-- basic.Basic(`
++ basic.QBasic(`
     10 PRINT "HELLO WORLD"
     20 GOTO 10
   `)

Otherwise maybe add an optional option parameter to specify support for certain extensions / dialects / whatever.

var basic = require('wwwbasic')
basic.Basic({ qbasic: true }, `
  10 PRINT "HELLO WORLD"
  20 GOTO 10
`)

Related to #10 #11 #12 #21

@FellippeHeitor
Copy link
Collaborator

The original look of the output screens indicated an earlier version of BASIC as target, but since we're aiming at Nibbles and Gorillas, I understand QBasic is going to be the broader goal, so maybe it'd be the case to indicate when an older command set is to be supported instead.

@thomasmcneill
Copy link
Collaborator

Why not have a type of preprocessor command that allows us to indicate which version of BASIC the code is targeting? This would allow us to implement certain PEEK/POKE instructions based on the target.

10 TARGET=QB45
10 TARGET=PCDOS
10 TARGET=TRS80III <--- where I started

@flagxor flagxor self-assigned this Sep 20, 2018
@flagxor
Copy link
Collaborator

flagxor commented Sep 20, 2018

I imagine we'll likely want a few different ways to specify dialect:

  • Some inline way. This probably can use basic's "pragma", OPTION, e.g.:
    • OPTION DIALECT TRS80
  • Some way to specify on a script tag:
    • <script .. dialect="TRS80"...>
  • Some way to specify programmatically:
    • basic.QBasic / or basic.Basic(... {bag of options} ...)
    • Short cuts could be fine, but likely in the limit we'll want a bag of several things.

Theoretically QBasic is a superset of GWBASIC which is a superset of BASICA, but that's not entirely true as each has a definition defined by a single implementation and there are quirks + intentional breaks in compat.

FreeBasic I believe mushes together things by default, but has options for specific dialects.

Probably some thought needs to go into:

  • What are the dialects and how "complete" should they be (in the limit that might make them quite complex to be bug for bug / limitation compatible). E.g. do we really want Applesoft's identifier limits?
  • Which can be used together. There are some where the grammars clash.

@FellippeHeitor
Copy link
Collaborator

In QB64, we have QBasic/QuickBASIC 4.5 as a goal for compatibility. Eventual retrocompatibility was indirectly implemented because of them being a superset of GWBASIC (namely the syntax for the OPEN command for one). I know Freebasic has a #lang switch right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants