germinolegrand / Cpp.js

JS interpreter in C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

Cpp.js is a project with no pretention. It aims to be a JS interpreter in a C++ environment. The JS environment should be highly and easily manipulable from simple modern C++.

var{{
    {"console", {{
        {"log", var(
            [](auto args){
                std::copy(std::begin(args), std::end(args), std::ostream_iterator<var>(std::cout));
                std::cout << '\n';
                return var{};
            })
        }
    }}},
    {"exit", var(
        [](auto args)->var{
            exit(args.size() >= 1 ? static_cast<int>(args[0].to_double()) : 0);
        })
    }
}}

Currently it is still in an early stage, but is advanced enough to support a basic Interpreter.

You will find examples in tests/.

Build

This repository has submodules, don't forget init them :

# git submodule update --init

For Code::Blocks (see https://github.com/chris-be/premake-codeblocks):

# cd build
# premake5 codeblocks

For Linux:

# cd build
# premake5-linux64 gmake2
# make

For MinGW64:

# cd build
# premake5 gmake2
# mingw32-make

About

JS interpreter in C++


Languages

Language:C++ 98.6%Language:Lua 1.4%