04-09-2024, 06:27 PM
How is QB64 written? What coding language is used? And is it always the same one?
How is QB64 written?
|
04-09-2024, 06:27 PM
How is QB64 written? What coding language is used? And is it always the same one?
04-09-2024, 06:33 PM
The backend is written in C++ but the majority of the IDE is written in QB64 itself. Galleon basically used C++ until he could create something that could write itself.
Tread on those who tread on you
04-09-2024, 06:40 PM
04-09-2024, 08:12 PM
Well, no. Not everything. It depends on what the feature is and how it would be best implemented.
Tread on those who tread on you
04-09-2024, 10:47 PM
QB64 is a multi-language software. What QB64 and QB64PE both do, is they take BAS-code, then translate it to C-code, where a c-compiler then compiles it to a working executable.
For almost all of the BAS handling, we tend to use QB64.bas which you can find in the /source folder. This is the code which makes our IDE and which we use to enter our program with. It does the syntax checking, formatting, and all such things for us. It all does the translation process for us, which processes those BAS commands that you enter, and turns them into C-commands. libqb.cpp and all the rest of QB64 contains the c-code which holds the libraries, routines, and such that actually compiles. They're located inside the internal/c folder, and the gcc compiler can be found one subfolder deeper than them, in the internal/c/compiler folder. So the workflow is basically: source/qb64pe.exe <-- enter your program here. It translates it to C-code. internal/c/qbx.cpp <-- this is the actual entry point where the C-code exists (what you write is basically #INCLUDEd in it), which we compile when you hit F5 in the IDE. internal/c/compiler <-- and here is where the compiler/linker, and all exists which compiles that completed C-code into the executable for you.
04-10-2024, 12:33 AM
(04-09-2024, 10:47 PM)SMcNeill Wrote: QB64 is a multi-language software. What QB64 and QB64PE both do, is they take BAS-code, then translate it to C-code, where a c-compiler then compiles it to a working executable.So, would it be helpful to learn C in order to better understand and/or contribute to QB64PE? (04-09-2024, 06:27 PM)Tim Wrote: How is QB64 written? What coding language is used? And is it always the same one? (04-09-2024, 06:33 PM)SpriggsySpriggs Wrote: The backend is written in C++ but the majority of the IDE is written in QB64 itself. Galleon basically used C++ until he could create something that could write itself.This is extremely common in programming language development. This solves the "chicken and egg" problem. (How do you get the "chicken" - i.e. the compiler - to produce the "eggs" - i.e. the executable programs, when you don't have the chicken in the first place?) When you don't have a compiler to compile the language, there are four possible solutions:
Before there were other programming languages, compilers were written using assembly language, using the 3rd method above. Then C and other languages were developed, and now people almost always use a high-level language to write a compiler. (04-09-2024, 06:40 PM)Tim Wrote: So, any and all new features are written in QB64, then? (04-09-2024, 08:12 PM)SpriggsySpriggs Wrote: Well, no. Not everything. It depends on what the feature is and how it would be best implemented.It also depends on the language. Some languages are capable of creating the entire executable. Others, like QB64/QB64pe are what are called "transpilers." A transpiler takes code in one language, and translates it into another language. The GNU Pascal compiler is also a transpiler. It does provide one advantage over a straight compiler: if the target language is sufficient to express every feature of the language, it becomes machine and/or operating system independent. This is why QB64(pe) can be used on Windows, Linux, and Mac. (04-09-2024, 10:47 PM)SMcNeill Wrote: libqb.cpp and all the rest of QB64 contains the c-code which holds the libraries, routines, and such that actually compiles. They're located inside the internal/c folder, and the gcc compiler can be found one subfolder deeper than them, in the internal/c/compiler folder.Actually, it's not just the C/C++ compiler, it's the entire Gnu toolchain (which parts of it the C compiler needs anyway.) It includes:
While 1
Fix Bugs report all bugs fixed receive bug report end while (04-10-2024, 12:33 AM)Tim Wrote: So, would it be helpful to learn C in order to better understand and/or contribute to QB64PE?Not necessarily, unless you want QB64pe to have some other feature that is not capable of being handled by existing code and which you're unable to sweet talk, err I mean cajole, someone currently working on the program to put it in. If you want to get better as a programmer, read programs. Lots of them. I have, and I still do; there is no such thing as learning "too much." And I've been writing programs since I first learned Basic, oh, over 45 years ago. You could take a look at QB64pe.bas; it's located in the source folder in the folder where QB64pe is installed. But be advised, compilers can be very complex. Or look at some archives of Quick Basic software and examine it. My own collection of Basic language source code, mostly in zip files, is about 8.5 GB, over 60,000 files. I have a lot more reading to do...
While 1
Fix Bugs report all bugs fixed receive bug report end while
04-10-2024, 02:36 AM
Thank you, everyone, for the answers. Still learning here. But never bored.
04-10-2024, 03:55 PM
(04-10-2024, 02:36 AM)Tim Wrote: Thank you, everyone, for the answers. Still learning here. But never bored.As I said - or maybe just implied - I'm still learning too, and I've been writing programs for over 45 years. And I'm almost never bored, except maybe when my computer has a fault, or the operating system does, or the compiler does, or... In which case, I can't use my computer, then I'm only bored until the withdrawal symptoms kick in...
While 1
Fix Bugs report all bugs fixed receive bug report end while |
« Next Oldest | Next Newest »
|