Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Yab to C converter
#1
Brick 
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.
Reply
#2
To work well with the Haiku GUI, one would have to incorporate some c++ to make the appropriate calls. The yab source code could be used as an example as yab uses c and c is ueed to cal c++ wrappers to call Haiku GUI elements.
Reply
#3
Thanks for your reply! I'll see what I can do.
Reply
#4
After looking at the YABASIC parser source, I am not quite familiar with Flex and Bison so I may have to start my YAB transpiler some other time after I have finished the Kitten transpiler for running AmosPro on AmigaOne PowerPC.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)
Free Web Hosting