The L-BASIC compiler - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Works in Progress (https://staging.qb64phoenix.com/forumdisplay.php?fid=9) +---- Thread: The L-BASIC compiler (/showthread.php?tid=1369) |
RE: The L-BASIC compiler - Kernelpanic - 01-07-2023 Now I know what the message means: "codegen: Bad expr type 18". This does not mean a line number. I noticed it just now when I got the message again. Code: (Select All) 'LBasic - 7. Jen. 2023 PS D:\Lab\Lukebasic> lbasic LBasicKaufpreis.bas codegen: Bad expr type 18 There is still a lot to try and learn. RE: The L-BASIC compiler - Kernelpanic - 01-07-2023 Last try for today: Code: (Select All) 'LBasic, zwei Zahlen addieren - 7. Jan. 2023 PS: @Luke - You are using the Clang compiler, why not the GCC (Linux), or the MingW for Windows? PS2: Could it be that the Clang compiler is missing here? I have installed the MingW64. RE: The L-BASIC compiler - mnrvovrfc - 01-07-2023 (01-07-2023, 04:01 PM)Kernelpanic Wrote: This line: Code: (Select All) Print -- Fehler? The stuff after "Print" needs to be surrounded by double quotation marks. I'm not able to run Luke's creation straight away but the "bad integer" or something like that might point to the "LOCATE , 2" line, might have to use "CSRLIN" function to get the current cursor line and fill in the "LOCATE row, column" instead of leaving out the row. If not, it could be your using the apostrophe at the end of code lines. RE: The L-BASIC compiler - luke - 01-08-2023 The "bad expr type 18" error is because it doesn't know how to build code for the INPUT statement. I wasn't kidding when I said it has very poor support for most commands. It also doesn't know how to compile arrays, or LOCATE (though arrays and user defined TYPEs are probably next on the list). The error about clang not found is a genuine bug though, looks like it doesn't handle being on the %PATH% very well. You might be able to work around that by setting the LLVM_ROOT environment variable to point to the llvm directory. Thanks for trying it out, and sorry it's so limited for now. So many commands... P.S The gcc/clang/mingw situation is complicated, but basically mingw is a set of libraries that is combined with either gcc or clang to build a windows compiler and toolchain. For lbasic you could probably replace clang-mingw with gcc-mingw and it'd be okay, but the more vital file is the libLLVM-14.dll which contains all the logic for generating machine code that lbasic calls directly. Unlike QB64, lbasic isn't generating C code and compiling it. It emits actual machine code object files, then calls clang to link it with the runtime library. I could call the linker (ld) directly but clang adds all the correct flags to make life easier. To compare it with QuickBasic, running BC.EXE is the equivalent of doing "lbasic -e obj". Without -e obj, lbasic will do the equivalent of also running LINK.EXE and linking against BCOM45.LIB. RE: The L-BASIC compiler - Kernelpanic - 01-08-2023 Clang is found like this, but what does this mean: Parser: Line 2: " I know how to call the QuickBasic compiler and linker using a bat file from before, because I had noticed that some programs were about 1/3 smaller in this way than created by the IDE. One reason could be the Linux-style path specification. So it could be that the clang compiler is not found for this reason. Code: (Select All) Dim As Integer zahl1, zahl2, summe I think I now know where the error could lie in part. The compilation of "hello-luke" only worked because the source file was in the same directory as "lbasic". But with two other programs it didn't work again. - Complicated! RE: The L-BASIC compiler - mnrvovrfc - 01-08-2023 (01-06-2023, 10:59 PM)mnrvovrfc Wrote: One of the "QB64 Samples" programs is a LISP interpreter. I should have taken some time to play with it, instead of trying to dive into Racket. Racket was released as Flatpak about two weeks ago, I have just discovered. Kernelpanic the "Dim" line has to be changed to: Code: (Select All) Dim zahl1 as Integer, zahl2 as Integer, summe as Integer RE: The L-BASIC compiler - Kernelpanic - 01-08-2023 (01-08-2023, 08:22 PM)mnrvovrfc Wrote: Kernelpanic the "Dim" line has to be changed to: Unfortunately it doesn't work either. RE: The L-BASIC compiler - luke - 01-08-2023 You're nearly there! It doesn't know how to compile END, but it does know SYSTEM so you can use that instead. RE: The L-BASIC compiler - Kernelpanic - 01-08-2023 (01-08-2023, 09:55 PM)luke Wrote: You're nearly there! It doesn't know how to compile END, but it does know SYSTEM so you can use that instead. Ok, this works without end now, with "two numbers...". The next program doesn't work again: "KW-PS2.bas". - The devil is in the details! Quote:D:\Programme\lbasic>lbasic Zwei-Zahlen-addieren.bas KW-PS2.bas Code: (Select All) Option _Explicit RE: The L-BASIC compiler - a740g - 01-10-2023 This is awesome Luke! I saw this project on your GitHub a long time ago and starred it. At that time, I was wondering why you would write yet another BASIC transpiler. I never knew at that time that you were generating LLVM IR. I bet your end goal is to make this self-hosting. I wish you all the best and will keep an eye on this project. |