FreeBasic interpreter?
-
- Posts: 360
- Joined: Jun 07, 2005 20:59
- Location: england, somewhere around the middle
- Contact:
could you please explian to me how I could use the standard fb package and the gdb debugger to develop easily from within a network where every application must be ok'd by the admin by hand (once for each recomplie)?
You could do more awsesome things eventually aswell, like writing macros in other applications in fb (like image proccessing algos in paint proggies [obviously the program would need to allow you to use it it], or even programs so customisable that by holding alt and right clicking a control [arbatrary keys used for example] you could change what it did)
anyway, it's kinda beside the point, thousands of artists paint useless paintings every day...
anyway, before suggesting all this stuff, i should really fix my gfxlib commands... they're screwed up badly.....
You could do more awsesome things eventually aswell, like writing macros in other applications in fb (like image proccessing algos in paint proggies [obviously the program would need to allow you to use it it], or even programs so customisable that by holding alt and right clicking a control [arbatrary keys used for example] you could change what it did)
anyway, it's kinda beside the point, thousands of artists paint useless paintings every day...
anyway, before suggesting all this stuff, i should really fix my gfxlib commands... they're screwed up badly.....
FreeBasic interpreter?
As I see it, the most practical place to apply this interpreter project is towards a scripting engine. As far as interpreters go, it might be easier to use the Small Basic interpreter (which can be found at http://smallbasic.sourceforge.net/).
hi angros47,
here is a function to get symbols and values from a string.
may this can help you to Interpret "PRINT 1+1" :)
Compile With FreeBASIC 0.18b1 as console.
Use:
here is a function to get symbols and values from a string.
may this can help you to Interpret "PRINT 1+1" :)
Compile With FreeBASIC 0.18b1 as console.
Use:
Code: Select all
Declare Function Split(Byref ss As String,Byref lct As Integer Ptr) As Integer
Dim s As String
Dim n As Integer,c As Integer
Dim lct(100*3-1) As Integer
Input s
n = Split(s,@lct(0))
'Stored In lct(c*3):StartLocation,lct(c*3+1):Length,lct(c*3+2):Type
For c = 0 To n-1
Select Case lct(c*3+2)
Case 0
Print "Symbol:";
Case 1
Print "Int32:";
Case 2
Print "Single:";
Case 3
Print "Int64:";
Case 4
Print "Double:";
Case 5
Print "String:";
End Select
Print Mid(s,lct(c*3),lct(c*3+1))
Next C
Sleep
End
Function Split(Byref ss As String,Byref lct As Integer Ptr) As Integer
'Copyright Eluli Simpray Sheslin, 2007
'Please Make Sure lct Have Enough Space Before Calling This Function.
'Lct[N*3] :Start Location
'Lct[N*3+1] :Length
'Lct[N*3+2]= 0:Symbol 1:Int32 2:Single 3:Int64 4:Double 5:String
Dim As Integer C,S,E,N,IsIn,InQuato,Dot
If Len(ss) = 0 Or Left(ss,1) = "'" Then Return 0
Dim st As String = ss + " "
C = 1 : S = 1 : E = 0 : InQuato = 0 : IsIn = 0
While C<=Len(st)
Select Case Asc(st,C)
Case 32,9,44 'Spliters Not Return : "SPC TAB ,"
If InQuato = 0 Then
If IsIn Then
lct[N*3] = S
lct[N*3+1] = C - S
If IsIn = 2 Then
If C - S >7 Then
lct[N*3+2] = 3 + Dot
Else
lct[N*3+2] = 1 + Dot
End If
Else
lct[N*3+2] = 0
End If
IsIn = 0
N += 1
Endif
Endif
Case 43,45 ' +,-
If InQuato = 0 Then
If IsIn = 0 Then
IsIn = 1
S = C
Dot = 0
Else
Goto Other
Endif
Endif
Case 46
If InQuato = 0 Then
Dot = 1
If IsIn = 0 Then
IsIn = 1
S = C
Elseif IsIn = 3 Then
Goto Other
Endif
Endif
Case 48 To 57 '0-9
If InQuato = 0 Then
If IsIn = 0 Then
IsIn = 2
S = C
Dot = 0
Elseif IsIn = 1 Then
IsIn = 2
Endif
Endif
Case 69,101 'E,e
If InQuato = 0 Then
If IsIn = 0 Then
IsIn = 3
S = C
Elseif IsIn = 2 Then
Dot = 1
Endif
Endif
Case 65 To 90 , 97 To 122 ,95
If InQuato = 0 Then
If IsIn = 0 Then
IsIn = 3
S = C
Endif
Endif
Case 34 ' "
If InQuato Then
E = C
lct[N*3] = S
lct[N*3+1] = E-S+1
lct[N*3+2] = 5
N += 1
InQuato = 0
Else
S = C
InQuato = 1
Endif
Case Else
Other:
If InQuato=0 Then
If IsIn Then
lct[N*3] = S
lct[N*3+1] = C - S
If IsIn = 2 Then
If C-S>7 Then
lct[N*3+2] = 3 + Dot
Else
lct[N*3+2] = 1 + Dot
End If
Else
lct[N*3+2] = 0
End If
N += 1
IsIn = 0
Endif
lct[N*3] = C
lct[N*3+1] = 1
lct[N*3+2] = 0
N += 1
Endif
End Select
C += 1
Wend
Return N
End Function
FBSL isn't bad, but it isn't open source
A lot of basic compilers and interpreters can be found on http://basic.mindteq.com/
Also, some compilers with source code can be found at http://www.exmortis.narod.ru
bye
A lot of basic compilers and interpreters can be found on http://basic.mindteq.com/
Also, some compilers with source code can be found at http://www.exmortis.narod.ru
bye
I'm going to try either of the following two options:
-- Build me a LiveCD that contains FreeBASIC and the latest version of Insight. I hope that everything will fit into ram because if it will then I've got some sort of an interpreter. The biggest problem here is disksize of course (as the contents of the disk has to be copied to ram).
-- Use Euphoria as a BASIC - interpreter. Euphoria - syntax is a lot like FreeBASIC - syntax and some Euphoria - programmers have actually written some libraries containing functions that mimic BASIC - functions (functions like MID, LEFT etc....). And whatever is not like FreeBASIC I will either fix after testing/writing of the software or compensate by using type - definitions. The idea would be to develop the software with Euphoria and when I'm done debugging translate it to FreeBASIC.
I'm hoping the Live - CD - trick is going to work but it's going to be difficult. You need an enormous amount of development - files if you want to develop software. And after booting the Live - CD and starting a desktop there still has to be a lot of RAM left to for the compiler, the debugger and whatever dyamic - link -libraries your software uses.
If it is possible to write a FB - interpreter + debugger then that would be great but I am not keeping my hopes up for that. If the Live - CD - thing works I'll be more then happy to keep on using the FB - compiler.
-- Build me a LiveCD that contains FreeBASIC and the latest version of Insight. I hope that everything will fit into ram because if it will then I've got some sort of an interpreter. The biggest problem here is disksize of course (as the contents of the disk has to be copied to ram).
-- Use Euphoria as a BASIC - interpreter. Euphoria - syntax is a lot like FreeBASIC - syntax and some Euphoria - programmers have actually written some libraries containing functions that mimic BASIC - functions (functions like MID, LEFT etc....). And whatever is not like FreeBASIC I will either fix after testing/writing of the software or compensate by using type - definitions. The idea would be to develop the software with Euphoria and when I'm done debugging translate it to FreeBASIC.
I'm hoping the Live - CD - trick is going to work but it's going to be difficult. You need an enormous amount of development - files if you want to develop software. And after booting the Live - CD and starting a desktop there still has to be a lot of RAM left to for the compiler, the debugger and whatever dyamic - link -libraries your software uses.
If it is possible to write a FB - interpreter + debugger then that would be great but I am not keeping my hopes up for that. If the Live - CD - thing works I'll be more then happy to keep on using the FB - compiler.
-
- Posts: 252
- Joined: Mar 12, 2006 16:25
Emitter as Interpreter
Is it possible to use an FB Emitter as Interpreter? This way it should be easier to make it 99% percent compatble with FreeBasic. Victor is working on a C Emitter. Perhaps he could make a Documentation how to write an Emitter.
There are then some possibilities.
- Emitter as direct interpreter.
- Emitter which produces P-Code + an Interpreter that must be coded as well.
- Emitter which produces Code for an existing Interpreted language like Java, Python ...
P-Code is the System QB uses. I think it would be the cleanest way.
There are then some possibilities.
- Emitter as direct interpreter.
- Emitter which produces P-Code + an Interpreter that must be coded as well.
- Emitter which produces Code for an existing Interpreted language like Java, Python ...
P-Code is the System QB uses. I think it would be the cleanest way.
-
- Posts: 1706
- Joined: May 27, 2005 6:34
- Location: Cambodia, Thailand, Lao, Ireland etc.
- Contact:
Re: Emitter as Interpreter
victor has said many times that this would be possible, but what is left is all the hard work to do it. As for documentation, the code is all the documentation you can expect. Everybody here can read code if they put their mind to it.RockTheSchock wrote:Is it possible to use an FB Emitter as Interpreter? <snip>
Garvan
Where's JaBa
hi
the link to JaBa is broken. Is it still alive?
the link to JaBa is broken. Is it still alive?
You can still access site by www.archive.org , and also download jaba, but the last version available (1.01) is the same from 2000 to 2006. So I think it's a dead project.
Of course, you can always use it (maybe it's very stable if nobody needed to release new versions in 6 years... remember old rule "when a software works, it's obsolete")
Of course, you can always use it (maybe it's very stable if nobody needed to release new versions in 6 years... remember old rule "when a software works, it's obsolete")