felixhao28 / JSCPP

A simple C++ interpreter written in JavaScript
https://felixhao28.github.io/JSCPP/
MIT License
860 stars 72 forks source link

Cannot use the OOP feature of Cpp #154

Open onion108 opened 2 years ago

onion108 commented 2 years ago

My code run well on my local compiler but can't run normally on JSCPP. Source Code:

#include <iostream>
using namespace std;

class Main {
    public:
    Main() {
        cout << "Program Started.";
    }
    int run() {
        cout << "Hello, World!" << endl;
        return 0;
    }
    ~Main() {
        cout << "Program Exited.";
    }
};

int main() {
    Main mainProgram;
    return mainProgram.run();
}

And that's what JSCPP says:

Error: ERROR: Parsing Failure:
line 4 (column 12): ce std;\n\nclass Main {\n    public:\n    Ma
------------------------------------------^
Expected "(", ",", "/*", "//", ";", "=", "[" or [ \n\r\t\u000B\u000C] but "{" found.
felixhao28 commented 2 years ago

Most object-oriented features are not implemented yet.