Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The QuickerBasic project
#1
I previously completed the 4th and final release of the QuickerBasic preliminary scratch interpreter. It is available at:

http://qkrbasic.sourceforge.net/qkrbasic-prelim4.zip

It is programmed in VB, although a binary is included. Note that the real thing will be programmed in C (and maybe some C++).

It currently implements a wide range of standard library functions and programming contructs including:
expressions, variable assignment, line labels, line numbers, one-line IFs, GOTO, PRINT, INPUT, multi-line IFs, DO/LOOP, FOR/NEXT, EXIT DO/FOR/WHILE, DIM/DIM SHARED, DEFxxx, END/SYSTEM, ABS, ATN, COS, EXP, LOG, RND, SGN, SIN, SQR, TAN, LET, RANDOMIZE, CLS, LOCATE, COLOR, ASC, CHR, MID, INSTR, LCASE, LEFT, RIGHT, UCASE, LTRIM, RTRIM, SPACE, SPC, TAB, STRING, LEN, CDBL, CINT, CLNG, CSNG, FIX, INT, HEX, OCT, STR, VAL, INKEY, GOSUB, RETURN, SELECT CASE/CASE/END SELECT, WHILE/WEND, $STATIC arrays, DECLARE SUB/FUNCTION and SUBs/FUNCTIONs.

What it doesn't implement is graphical standard functions, $DYNAMIC arrays and user-defined types.

A range of examples/tests is included, although I believe there will still be a lot of bugs in the scratch interpreter. However, the performance or stability of the scratch interpreter is not the main reason why I'm posting here.

I'm going to begin the real thing soon, and I'd like a bit of feedback on what kinds of enhancements and extensions you would like to see QuickerBasic implementing over QuickBasic. A plan is available at:
http://qkrbasic.sourceforge.net/qkrbasic.txt
Remember, feedback is a critical component of open-source projects, so i encourage you to reply with your ideas. This is your chance to help shape a "modern" QuickBasic which can be actively managed and maintained.
Of course, as per previous feedback, improved efficiency of compiled code and greater memory capacity will definately be implemented.

With that said, if anyone knows C and is interested in helping out with the project, feel free to e-mail me (someone42_000 at hotmail dot com). In particular, I'm looking for someone to program a GUI for an IDE (especially if you can do it with wxWidgets).

You can also help out, even if you don't know C, by making a set of testing programs (a "test suite") for QuickerBasic. Testing wierd quirks, various contructs, capacities and combinations of quirks and contructs would prove to be very useful when QuickerBasic is able to compile/interpret certain code, and when I'm making changes to existing clean code.
Reply
#2
Very nice.

I am suitably impressed.

How do I get an executable? Or is that not implemented?

The parser seems to work fine...I tried some fairly dodgy stuff.

Good job man.

I don't see why you don't stick to VB Tongue I might help out there. I could definately help with the IDE design (in VB) if you need the help. I am 'aetherfox' on sourceforge.
·~¹'°¨°'¹i|¡~æthérFòx~¡|i¹'°¨°'¹~·-
avinash.vora - http://www.avinashv.net
Reply
#3
Quote:How do I get an executable? Or is that not implemented?

Nope, it's only an interpreter at the moment. The main reason for that is if I wanted to make a compiler I'd have to program a standard library, and I only made this as a sort of prototype.
The real thing of course, will feature both an interpreter and compiler, although it is likely the interpreter will be functional before the compiler.

Quote:I don't see why you don't stick to VB I might help out there. I could definately help with the IDE design (in VB) if you need the help. I am 'aetherfox' on sourceforge.

I suppose the IDE can be programmed in VB. I definately want to do the interpreter/compiler in C/C++ for speed, portability and because certain things such as user-defined types are very difficult to do in VB.

I was thinking of implementing the interpreter/compiler as a DLL, so the IDE can have an integrated interpreter, pretty printer, syntax checker etc. while maintaining a modular design. This would also make a text-mode IDE (for all those addicted to the blue screen) easy.
Reply
#4
This most definately looks very promising! All the best luck!
Jumping Jahoolipers!
Reply
#5
very cool indeed. I hope you complete this program. We want a win32 compiler Big Grin
Reply
#6
Yeah, I see your point. That would be clever.

Well, I am in the mood for something challenging.
I would love to make something nice and streamlined...
I could do the basic interface, syntax highlighting, probably indentation/tabspace support, adjustable toolbars. Who knows, I've never tried it but I could probably work to a syntax checker.

Gimme a shout.
·~¹'°¨°'¹i|¡~æthérFòx~¡|i¹'°¨°'¹~·-
avinash.vora - http://www.avinashv.net
Reply
#7
Hello, someone42

QuickerBasic got me interested, and I decided to compare the speed of one program I had just written. While trying to parse it, I had to get rid of many commands, like REDIM, ERASE, SWAP and others. Finally I made QuickerBasic happy with my program and it was executed. However, maybe it's because of my horrible programming, the program behaviour was completely different from Qbasic. I was trying to generate a certain two-dimensional array and, while searching for it, a few auxiliary numbers are printed on the screen, so these numbers are completely different when run with QuickerBasic, that's how I know the program acts in the wrong way. I use Qbasic Extended, that's probably 7.1, but I don't think I used anything not compatible with 4.5.

Anyway, here's the program. If you run it with Qbasic and QuickerBasic, you'll notice the difference. Please ignore the commented sections in the program. I doubt this silly little piece of code will help you improve your project, but if it does, I'll be happy .

I hope we'll see the final product soon. Thanks for developing a good thing.
Reply
#8
Thanks for the bug report. I found out what I was doing wrong. I was calculating array sizes wrongly: if the lower bound for an array is 0 and the higher bound is 7, then the size is **8** scalars. I was calculating the size as "(max - min)" so some array accesses were trampling on other variables (in your case "eil").

Previously I did not notice it since I had allocated one more scalar space anyway, to accomodate (although not fully) for a different bug in QuickBasic. This meant the bug went unnoticed with a one-dimension array (which is what I tested).

I have an updated version at:
http://qkrbasic.sourceforge.net/qkrbasic-prelim4a.zip (I know it was supposed to be "final", but I'm doing this for the sake of completion.)

However, your code runs much slower in QuickerBasic than in QuickBasic. This is to be expected, as this is only a preliminary "scratch" interpreter. When you are using it to run p_expr1d.bas inside VB, you are effectively running an interpreter inside an interpreter inside an interpreter! The "real thing" of course, will be much faster.
Reply
#9
Nice.

But I have some advice: for the final project, do just the compiler. Making an interpreter and then a compiler is just working twice. I suggest you not to do it from scratch as well. THere are great tools out there that will help you to parse, build the gramatic, interpret it and generate a program tree, and then perform the code generation upon it. ANTLR is great.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#10
Quote:But I have some advice: for the final project, do just the compiler. Making an interpreter and then a compiler is just working twice.

Up to (and including) the code generation stage, the interpreter and compiler are the same. I'm going to implement both, because debugging (both writing a debugger and debugging code) is a lot easier with an interpreter.

Quote:THere are great tools out there that will help you to parse, build the gramatic, interpret it and generate a program tree, and then perform the code generation upon it. ANTLR is great.

I'm actually using flex for the lexical analyser (in fact I have it implemented already).

For the parser, I considered PCCTS (the "old" ANTLR) because it generated recursive-descent parsers, but writing an RDP generator which accepts a left-factored, left-recursion free grammar as input is simple enough.

The main reason for writing my own RDP generator...umm...I forgot the reason, something to do with flexibility maybe?? (but I spent considerable time reviewing it and in the end I decided to write my own parser generator).

But thanks anyway for advising me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)