The L-BASIC compiler
#10
(01-07-2023, 02:27 AM)luke Wrote:  However it's an opportunity to experiment with a different architecture, both in terms of the compiler itself and the runtime libraries. The underlying machine code generator (llvm) has support for Just-In-Time compilation, which I expect to be able to use to add an interactive interpreter mode while reusing most of the parsing and runtime code. It is also possible to target webassembly, which opens interesting possibilities for compiling programs to run in the browser.

Also an lbasic hello world program is only 76KB and runs instantly, so I'm pretty happy with that Smile

Thanks for the answer. Yes, that's right, one learn from experimenting like this; I did that too when I started with Basic & Co. Ok!

I put "lbasic" in the path and tried it with arrays, there are problems; see messages. Maybe it helps.
Code: (Select All)
Rem Luke-Basic, 7. Jan. 2023

Dim As Integer zahlenFeld(5, 5)

Dim As Integer a, i, j, z
Dim As Integer zeile, spalte

Locate 2, 2

z = 1
For i = 1 To 5
  For j = 1 To 5
    zahlenFeld(i, j) = z
    Print Using "## "; zahlenFeld(i, j), '"Using" Fehler!
    z = z + 1
  Next
  Print: Locate , 2
Next

End

'-----------------------------------------------------------

z = 1
For i = 1 To 5 'Zeile 11 Fehler!
  For j = 1 To 5
    zahlenFeld(i, j) = z
    Print "## "; zahlenFeld(i, j),
    z = z + 1
  Next
  Print: Locate , 2
Next

Here is the mistake message: For i = 1 To 5 'Zeile 11 Fehler!
PS D:\Lab\Lukebasic> lbasic LFeld.bas
codegen: bad ll type: INTEGER[2]
Code: (Select All)
Rem Luke-Basic, 7. Jan. 2023

Dim As Integer zahlenFeld(5, 5)

Dim As Integer a, i, j, z
Dim As Integer zeile, spalte

Locate 2, 2

z = 1
For i = 1 To 5 'Zeile 11 Fehler!
  For j = 1 To 5
    zahlenFeld(i, j) = z
    Print "## "; zahlenFeld(i, j),
    z = z + 1
  Next
  Print: Locate , 2
Next

End

There is also an error message that I don't understand: 18 is Print(?) Error with or without "Print".  Huh  In QB64 it works.
Code: (Select All)
Option _Explicit

Dim PS As Double, KW As Double
Dim Auswahl As Integer

Print "1 -- PS in Kilowatt"
Print "2 -- Kilowatt in PS"
Print
Input "Ihre Wahl: ", Auswahl
Print

If Auswahl = 1 Then
  Input "Anzahl PS: ", PS
  KW = PS / 1.36

  Print -- Fehler?
  Print KW
Else
  Input "Anzahl Kilowatt: ", KW
  PS = KW * 1.36

  Print
  Print PS
End If

End

[Image: LBasic-Fehler2023-01-07-165444.jpg]
Reply


Messages In This Thread
The L-BASIC compiler - by luke - 01-06-2023, 01:16 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-06-2023, 08:06 PM
RE: The L-BASIC compiler - by cage - 01-06-2023, 10:24 PM
RE: The L-BASIC compiler - by SpriggsySpriggs - 01-10-2023, 02:39 PM
RE: The L-BASIC compiler - by mnrvovrfc - 01-06-2023, 10:59 PM
RE: The L-BASIC compiler - by mnrvovrfc - 01-08-2023, 08:22 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-08-2023, 09:40 PM
RE: The L-BASIC compiler - by PhilOfPerth - 01-06-2023, 11:01 PM
RE: The L-BASIC compiler - by SMcNeill - 01-07-2023, 12:05 AM
RE: The L-BASIC compiler - by luke - 01-07-2023, 02:27 AM
RE: The L-BASIC compiler - by Kernelpanic - 01-07-2023, 04:01 PM
RE: The L-BASIC compiler - by mnrvovrfc - 01-07-2023, 11:57 PM
RE: The L-BASIC compiler - by Jack - 01-07-2023, 01:39 PM
RE: The L-BASIC compiler - by bplus - 01-07-2023, 02:40 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-07-2023, 06:56 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-07-2023, 08:15 PM
RE: The L-BASIC compiler - by luke - 01-08-2023, 05:08 AM
RE: The L-BASIC compiler - by Kernelpanic - 01-08-2023, 05:24 PM
RE: The L-BASIC compiler - by luke - 01-08-2023, 09:55 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-08-2023, 11:21 PM
RE: The L-BASIC compiler - by a740g - 01-10-2023, 01:13 PM



Users browsing this thread: 9 Guest(s)