Author Topic: NaaLaa to Java  (Read 6480 times)

Marcus

  • Guest
NaaLaa to Java
« on: October 14, 2011, 04:50:30 PM »
The naalaa compiler can translate from naalaa basic code to Java. This is, obviously, how it creates Java applets. As I had already written all the parsing stuff, it was really easy to let the compiler spit out Java code instead of naalaa system calls and bytecode.

I might be a bit (or a lot) naive now. But if I wanted to write a pure translator from scratch, my first attempt would probably be to write something like an advanced search and replace program. I know that Markus Mangold (author of the EGSL interpreter) has been experimenting with a BASIC to Pascal translator with this approach, and it seems to be working quite well.
   How is it usually done? Need it be as complex as a compiler (/bytecode generator)?

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: NaaLaa to Java
« Reply #1 on: October 14, 2011, 04:56:32 PM »
ScriptBasic uses cascading external preprocessors for translation. The output of one preprocessor is the input for the next.


Marcus

  • Guest
Re: NaaLaa to Java
« Reply #2 on: October 25, 2011, 07:43:43 AM »
I have started working on a naalaa to c/c++ translator. I will leave the error checking to the normal compiler and then it'll basicly do what the naalaa to java translator already does.