Qbasicnews.com
June 21, 2018, 05:30:45 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: Can a compiler be made using QBasic?  (Read 5387 times)
BigBadKing
New Member

Posts: 3


« on: October 26, 2009, 07:16:32 AM »

 Huh can a compiler be made in QBasic, im tring to make one which is
called JotGB. if it is possible, how is that done??
Logged
Clippy
Member
*
Posts: 84



« Reply #1 on: October 27, 2009, 04:59:00 PM »

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

LPG
Member
*
Posts: 61

semper ubi sub ubi (always wear under wear)


« Reply #2 on: October 29, 2009, 11:58:18 PM »

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 
Logged

WHILE RPG$ <> "complete" : make up silly excuses :WEND
stylin
Ancient QBer
****
Posts: 445


« Reply #3 on: November 01, 2009, 05:31:48 PM »

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

stylin:
BigBadKing
New Member

Posts: 3


« Reply #4 on: November 03, 2009, 05:23:53 AM »

Thanks Guys!
Logged
Ninkazu
Been there, done that
*****
Posts: 1169



WWW
« Reply #5 on: November 03, 2009, 09:58:00 AM »

If you want to make a real compiler, look into Bison.
Logged

am an asshole. Get used to it.
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!