QBasic language spec
Asked Answered
A

4

10

I have been challenged by a friend to write a QBasic compiler in QBasic.

Where can I find a language specification for the latest version of the language?

Anglicist answered 18/12, 2010 at 8:33 Comment(8)
Do you mean QBasic 1.1 or QuickBasic 4.5?Shepley
The challenge states the QBasic interpreter that shipped with the earlier versions of Windows. The compiler must run on that version of QBasic and must be capable of compiling itself. I guess that would mean QBasic 1.1.Anglicist
You're in for quite a challenge, given that QBasic is an interpreted language and can't actually compile code.Shepley
A bit of back story - the conversation came about because we lamented that QBasic didn't have a binary compiler that we could use at school. All our code had to be interpreted through QBasic, at the time I wished I'd had the ability to write a compiler in QBasic so I could actually produce binaries. This challenge is the fufil this childhood dream - make a compiler to boostrap Qbasic from an interpreted language to a compiled language.Anglicist
Funny thing is, the QBasic that shipped with MS-DOS is just a stripped down version of QuickBASIC (IIRC 4.0, possibly 4.5) that had the compiler, binary tools, and "quicklib" support removed.Myxoma
@SimonJohnson, were you able to build this? I'm looking for a way to build an interpreter for the QBASIC (or variant) that would run on Windows 8. I would use another language that runs on a modern OS. I know you can use a DOS VM but I'd like to write one that runs on the machine itself. btw: Writing an interpreter of a language in the same language is called meta-circular interpretation. en.wikipedia.org/wiki/Meta-circular_interpretationMantoman
You can't compile Qbasic using Qbasic without the source to Qbasic. Try QB64 instead -- it CAN compile itself.Allergen
To reduce the confusion, no, QBasic/QuickBasic wasn't/isn't compiled in existing, traditional implementations but at the end of the day, there's no reason QBasic code couldn't be compiled in the same sense that any code could be compiled if someone wrote a compiler for it.Mindful
N
6

Microsoft's QBasic IDE comes with fairly complete documentation of the language and provided routines. So far as I know, that is about as complete a specification as you'll find, but it should be enough to write a compiler for (most of) the language, aside from undocumented DOS-specific peek/poke magic.

Nonrigid answered 26/4, 2011 at 3:17 Comment(2)
Yes, the QBasic help file contains a complete description of all commands.Marable
Perhaps also useful: here you can also find the complete documentation of QuickBASIC 3.0: ousob.com/ng/qbasic/ng320.phpUnison
K
5

QB64 is a nice clone/extension of QBasic which has a wiki that contains a very detailed language reference sorted alphabetically, by usage, or syntactically.

Note: keywords prefixed with an underscore ('_') are extensions that were NOT part of the classic QBasic language.

Keese answered 24/7, 2016 at 22:36 Comment(0)
A
2

QuickBasic 4.5 can compile into *.exe

Atterbury answered 23/6, 2012 at 6:24 Comment(0)
H
0

You can find the latest version by just typing in your browser: QB64 - it's how it is nowadays called/redone version of QBasic with a bigger aspect of opportunities. They have their forum, YT Channel and even Discord.

Hymnal answered 9/8, 2021 at 22:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.