10-05-2018, 12:53 PM
I know a technique to write a Basic compiler using C or C++ as a backend. Currently the stand-alone executable codes from Yab appear to just link an interpreter to a zipped copy of the source and I think I can do better.
Since BASIC isn't fully structured it'll have to be written using a Switch command in a While loop to act as a state machine. Also, to implement declaration of variables on-the-fly, it will have to be a pass-and-a-half compiler. That's a fancy way to say the compiler will have to write to a header file or so at the same time as the C source that includes it using its preprocessor.
Is there interest? My goal is to have some code written to serve as an example for another BASIC compiler I want to write. I may need help with the Haiku runtimes.
Since BASIC isn't fully structured it'll have to be written using a Switch command in a While loop to act as a state machine. Also, to implement declaration of variables on-the-fly, it will have to be a pass-and-a-half compiler. That's a fancy way to say the compiler will have to write to a header file or so at the same time as the C source that includes it using its preprocessor.
Is there interest? My goal is to have some code written to serve as an example for another BASIC compiler I want to write. I may need help with the Haiku runtimes.