Own Programming Language

Blitz3D Forums/Blitz3D Beginners Area/Own Programming Language

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If we were to create our own programming language, how would we go about it? I have made this very simple (3 commands) compiler and want to know if it will ever make it out there. I call it a ZT Compiler.

AppTitle "ZT COMPILER"

a$=CommandLine$()
If Left$(a$,5)="-ccas" Then
	filename$=Mid$(a$,7,Len(a$))
	If filename$=""
		End
	EndIf
Else
	End
EndIf

Global started=False

file=OpenFile(filename$)
If file=0
	Error("Could not compile!")
Else
	Repeat
		command$=ReadLine(file)
		If Eof(file)
			Error("DONE!")
		EndIf
		If command$<>"" Then
			If Left$(command$,7)="ADDline" Then
				therest$=Mid$(command$,8,Len(command$))
				If Left$(therest$,2)="[[" Then
					kk$=Mid$(therest$,3,Len(therest$))
					If Right$(kk$,2)="]]"
						txt$=Mid$(kk$,1,Len(kk$)-2)
						Print txt
					Else
						Error("Missing ]]!")
						Exit
					EndIf
				EndIf
			ElseIf Left$(command$,13)="[{ScreenRes}]" Then
				therest$=Mid$(command$,14,Len(command$))
				location=Instr(therest$,"|")
				If location>0
					width=Mid(therest$,1,location)
					height=Mid(therest$,location+1,Len(therest$))
					Graphics width,height,32,2
					started=True
				EndIf
			ElseIf command$="++QUIT"
				If started=True Then
					EndGraphics
					Exit
				ElseIf started=False Then
					Error("ScreenRes hasn't been initialized!")
					Exit
				EndIf
			EndIf
		EndIf
	Forever
CloseFile file
EndIf
End	
				
Function Error(message$)
	api_MessageBox 0,message$,"ERROR",0
End Function


The command line parms are : -ccas filename.zt

The ZT source file:
[{ScreenRes}]800|600

ADDline[[HEY EVERYBODY!!! THIS IS A TEST ON MY VERY]]
ADDline[[NIFTY COMPILER THAT I MADE BY MYSELF!!!]]

++QUIT