Qbasicnews.com
October 17, 2018, 06:08:01 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: The QuickerBasic project  (Read 12717 times)
someone42
Member
*
Posts: 44


« on: October 16, 2004, 11:21:05 AM »

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.
Logged
aetherfox
Been there, done that
*****
Posts: 1071



WWW
« Reply #1 on: October 16, 2004, 03:07:20 PM »

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.
Logged

~''i|~thrFx~|i''~-  
avinash.vora - http://www.avinashv.net
someone42
Member
*
Posts: 44


« Reply #2 on: October 17, 2004, 12:53:17 AM »

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.
Logged
barok
Na_th_an
*****
Posts: 1727


How about a tasty lead sandwich?


« Reply #3 on: October 17, 2004, 04:59:53 AM »

This most definately looks very promising!  All the best luck!
Logged

Jumping Jahoolipers!
TheBigBasicQ
*/-\*
*****
Posts: 4549



WWW
« Reply #4 on: October 17, 2004, 08:22:21 AM »

very cool indeed. I hope you complete this program. We want a win32 compiler Cheesy
Logged
aetherfox
Been there, done that
*****
Posts: 1071



WWW
« Reply #5 on: October 17, 2004, 09:42:42 AM »

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.
Logged

~''i|~thrFx~|i''~-  
avinash.vora - http://www.avinashv.net
dtamonis
New Member

Posts: 8


« Reply #6 on: October 24, 2004, 05:47:27 PM »

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.
Logged
someone42
Member
*
Posts: 44


« Reply #7 on: October 25, 2004, 05:51:46 AM »

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.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #8 on: October 25, 2004, 09:47:05 AM »

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.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
someone42
Member
*
Posts: 44


« Reply #9 on: October 26, 2004, 04:02:30 AM »

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.
Logged
tbbw
Member
*
Posts: 41



WWW
« Reply #10 on: October 26, 2006, 04:20:38 AM »

heh this feals kinda useless if u think of that Freebasic with -lang qb works like the Qbasic in the syntax.

i dont get why ppl need to make "ther own" compiler when there is one out there already that is free to use ( dont cost multum ).
Logged

lt;_[_[_[_T-B-B-W_]_]_]_>
E.K.Virtanen
Senior Member
**
Posts: 166



WWW
« Reply #11 on: October 27, 2006, 06:52:34 PM »

I think its damn great if someone skilled as someone42 comes on FB dev.team.
But i warn you. Even tho peoples might soon consider you as god, time to time youre the biggest evil ever seen on earth  Cheesy
Logged

url=http://www.ascii-world.com]ASCII-World.com[/url]
Yeah, nick changed from lurah, but bullshit's are the same.
barok
Na_th_an
*****
Posts: 1727


How about a tasty lead sandwich?


« Reply #12 on: November 05, 2006, 09:30:52 AM »

Quote from: "tbbw"
heh this feals kinda useless if u think of that Freebasic with -lang qb works like the Qbasic in the syntax.

i dont get why ppl need to make "ther own" compiler when there is one out there already that is free to use ( dont cost multum ).


They do it to learn, to gain experience, and to see if they can do it.  One of the reasons I program is to challenge myself.  They don't always do it just so you can profit.  For example, a few years ago I built a pure qbasic rpg engine (that's only 90% complete) just to see if I could create one, even though the majority of the forum-goers wondered what I was smoking for not using libraries.  Not only was it to challenge myself, but it was to learn as much about how the different aspects of an rpg engine worked.  Quickerbasic could just be a way for someone42 to teach himself new techniques, challenge himself, or do something nice for the community.  Don't question his work reasons for doing this.  I admire him for what he's done, even if freebasic still has it trumped.  Quickerbasic may only be a ripple in the pond, but someday it may become a wave.
Logged

Jumping Jahoolipers!
nkk_kan
Member
*
Posts: 73


« Reply #13 on: November 20, 2006, 10:11:04 AM »

just try to program out a simple compiler tbbw
and you'll understand why people try to make their own.. Cheesy
Logged

\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!