Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you #define END as "return(0);}" and put "int main(){" at the bottom of basic.hpp, you can have a complete BASIC program with #include "basic.hpp" at the top as the only indication that it's C++.

    #include "basic.hpp"
    _10: LET X = 1;
    // ...
    _150: END
I think multiple data types could also be added in a way that mostly fits with BASIC syntax. GW-BASIC uses sigil suffixes on variable names to denote their type:[1]

    $  String variable
    %  Integer variable
    !  Single-precision variable (default)
    #  Double-precision variable
Something like this might be possible with unions (e.g. _10: LET X.D = 3.14; _20: LET N.I = 42;), or you can tolerate a few different LET macros (LETS, LETI, LETD).

[1] http://www.antonis.de/qbebooks/gwbasman/chapter%206.html



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: