as i tolled already i`m good at c++ , and i studied assembling for some time , and i did a LOT of research on how to make a compiler in assembling or java virtual machine or so...
First you need to make a line parser (make it to read lines , and look for parameters)
then you need to make when it find parametres it converts them onto code found from engine for your language and..............
i`m realy working on a free compiler now , but i found a simple way to make a simple line parser in db . here it is.
IT`S MADE LIKE A ENGINE SO YOU CREATE YOUR OWN LANGUAGE IN IT , BELIVE ME ITS SIMPLE TO CREATE YOUR LANGUAGE IN IT...
here`s the code :
`Compiler engine made by : Dodic Ivan : Dodica : [email protected]
`You can use it for everything but , what but ? no but !
`you don`t have to give credits or do anything !
`-------------------------------------------------------------------------
`Simple suitable compiler engine for you to make your own
`compiler with ide (enviroment - the window in witch you write text...
`This compiler works by using the lines reading , it read lines
`and if it finds the command like (print-example) it will look into
`next line for instructions (what to print) , now we can use this way
`for everything...
`THAT`S HOW YOUR COMPILER WILL WORK , IF IT`S CREATE BOX OR SOMETHING
`LOOK INTO DB COMMANDS HELP TO SEE HOW MUCH LINES WILL HAVE TO BE
`BELOW THE COMMAND (EXAMPLE FOR 3d SPHERE)
`--------------
`make sphere
`1
`3
`--------------
`unfortionatly db(or dbpro) is not so powerful so we could make it better
`Our compiler has 5 lines only
`and it`s not realy a compiler becouse compiler change a file onto another
`example (.bas(basic)to .exe..)
`This is a line parser realy , but don`t think about it much becouse
`it realy is a lot to write about compilers....
`-------------------------------------------------------------------------
`---------------------Your compiler setup meny----------------------------
`-------------------------------------------------------------------------
`Name of your compiler
name$="My compiler example"
`-------------------------------------------------------------------------
` Your Language
`-------------------------------------------------------------------------
`For start commands are same as in db , change them into whatever you like
`offcourse not totaly same becouse it reads what to print or other parametres
`in the line below command ...
`unless the command has NO parameters like (cls) for example..
`For print
print$ = "print"
`For cls (clear screen)
cls$ = "cls"
`for image loading (our engine support only one image)
`so it can only be used like this:
`load image
`image.bmp
imgload$ = "load image"
`sprite (our engine supports only ONE sprite)
`so it can be used only like this:
`sprite (and you will get sprite from image !)
sprite$ = "sprite"
`load and play sound (load and play wav in same time!)
`and also it can only be one wav
`if you input twice , it will only load the last one
`command parameters will be like this:
`wav
`example.wav
wav$="wav"
`load and play midi (load and play midi in same time!)
`and also it can only be one wav
`if you input twice , it will only load the last one
`command parameters will be like this:
`midi
`example.mid
midi$="midi"
`ANYTHING PROGRAMMED WILL WAIT FOR A KEY , AND WILL END WHEN A KEY IS
`PRESSED
`It will not work if you add more lines for code here , our compiler
`is simple , so it`s not real that it has too much commands...
`-------------------------------------------------------------------------
` ENGINE-COMPILER CODE (DONT CHANGE THOSE LINES...)
`-------------------------------------------------------------------------
print "welcome to: ",name$
print "you have 5 lines , enjoy !"
input 1$
print "1.st line"
input 2$
print "2.nd line"
input 3$
print "3.rd line"
input 4$
print "4.th line"
input 5$
print "5.th line"
`Commands data
cls
`Output beggining:
`-----------------------------------------
`Parse the lines and look for "print" command
if 1$ = print$ then print 2$
if 2$ = print$ then print 3$
if 3$ = print$ then print 4$
if 4$ = print$ then print 5$
if 5$ = print$ then print "no more space , don`t use print on the last line!"
`Parse the lines and look for "cls" (clear screen) command
if 1$ = cls$ then cls
if 2$ = cls$ then cls
if 3$ = cls$ then cls
if 4$ = cls$ then cls
if 5$ = cls$ then cls
`Parse the lines and look for LOAD IMAGE command
if 1$ = imgload$ then load image 2$ , 1
if 2$ = imgload$ then load image 3$ , 1
if 3$ = imgload$ then load image 4$ , 1
if 4$ = imgload$ then load image 5$ , 1
if 5$ = imgload$ then print "no more space , don`t use load image on the last line!"
`Parse the lines and look for SPRITE command
if 1$ = sprite$ then sprite 1 , 0 , 0 , 1
if 2$ = sprite$ then sprite 1 , 0 , 0 , 1
if 3$ = sprite$ then sprite 1 , 0 , 0 , 1
if 4$ = sprite$ then sprite 1 , 0 , 0 , 1
if 5$ = sprite$ then print "no more space , don`t use SPRITE on the last line!"
`Parse the lines and look for Wav command
if 1$ = wav$ then load sound 2$,1 : play sound 1
if 2$ = wav$ then load sound 3$,1 : play sound 1
if 3$ = wav$ then load sound 4$,1 : play sound 1
if 4$ = wav$ then load sound 5$,1 : play sound 1
if 5$ = wav$ then print "no more space , don`t use WAV on the last line!"
`Parse the lines and look for MIDI command
if 1$ = midi$ then load music 2$,1 : play music 1
if 2$ = midi$ then load music 3$,1 : play music 1
if 3$ = midi$ then load music 4$,1 : play music 1
if 4$ = midi$ then load music 5$,1 : play music 1
if 5$ = midi$ then print "no more space , don`t use MIDI on the last line!"
`end
suspend for key
i make free 3d models , then you tell me some stuff about usseles posts and then something heppen...