Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can a compiler be made using QBasic?
#1
??? can a compiler be made in QBasic, im tring to make one which is
called JotGB. if it is possible, how is that done??
Reply
#2
You can create a program that creates another program module and compile it using a SHELL to BC.EXE.

But I don't see the point in using 16 bit programs with todays 64 bit PC's. This problem will only get worse with time.

Just look at how slow things have become on the forums!
Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip
Reply
#3
Potentially, I think it is possible to make a program in QB that works like a compiler. To do this you would make an interpreter that takes a program stored in a string or an array and executes it. Then you set the string/array to say something like "JotGB..." followed by X spaces (the max length of a program) and compile it to an EXE file. Then the compiler copies the interpreter program and replaces the "JotGB...              " with the code. I don't know if this would work, as i am to lazy to test it, but i think it might. If you like, I could make a simple program that compiles EXEs to say a string you enter or something.
This would not make very good or fast programs, and if you want to make a good programming language, I would recommend learning C or something.
Hope this helped,
LPG 
WHILE RPG$ <> "complete" : make up silly excuses :WEND
Reply
#4
Translating from a custom language to BASIC is one option, though you'll be limited to DOS-compatible targets. Another is to have your compiler output assembly language and either compile it with an external assembler or generate the machine code yourself. The speed of the resulting executable is then only limited to the assembly code you produce with your compiler, ie., it doesn't matter if you produce machine code in GW-BASIC, QBasic or Java; it all depends on your ability to generate fast assembly code. FreeBASIC was originally written in VB DOS, then as the language became more sophisticated was able to compile itself.
stylin:
Reply
#5
Thanks Guys!
Reply
#6
If you want to make a real compiler, look into Bison.
am an asshole. Get used to it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)