ASDAlexander77/TypeScript2Cxx

building error on ubuntu

Closed this issue · 2 comments

i build the generated cxx files on ubuntu with g++

build cmd: g++ -std=c++14 test.cpp -Icpplib -fconcepts -o testexe

I get the following error:

In file included from test.h:3:0,
                 from test.cpp:1:
cpplib/core.h:94:9: error: ‘Arithmetic’ does not name a type
 concept Arithmetic = std::is_arithmetic_v<T> && !std::is_same_v<T, bool> && !std::is_same_v<T, char_t>;
         ^~~~~~~~~~
cpplib/core.h:97:9: error: ‘ArithmeticOrEnum’ does not name a type
 concept ArithmeticOrEnum = (std::is_arithmetic_v<T> || std::is_enum_v<T>) && !std::is_same_v<T, bool> && !std::is_same_v<T, char_t>;
         ^~~~~~~~~~~~~~~~
In file included from test.h:3:0,
                 from test.cpp:1:
cpplib/core.h:100:9: error: ‘ArithmeticOrEnumOrNumber’ does not name a type
 concept ArithmeticOrEnumOrNumber = (std::is_arithmetic_v<T> || std::is_enum_v<T> || std::is_same_v<T, number>) && !std::is_same_v<T, bool> && !std::is_same_v<T, char_t>;
         ^~~~~~~~~~~~~~~~~~~~~~~~
cpplib/core.h:103:9: error: ‘BoolOrBoolean’ does not name a type
 concept BoolOrBoolean = (std::is_same_v<T, bool> || std::is_same_v<T, boolean>);
         ^~~~~~~~~~~~~
cpplib/core.h:106:9: error: ‘can_cast_to_size_t’ does not name a type
 concept can_cast_to_size_t = requires(T t) { static_cast<size_t>(t); };
         ^~~~~~~~~~~~~~~~~~
cpplib/core.h:109:9: error: ‘has_exists_member’ does not name a type
 concept has_exists_member = requires { T::exists; };
         ^~~~~~~~~~~~~~~~~
cpplib/core.h:113:23: error: expected template-name before ‘<’ token
     std::bool_constant<std::is_same_v<_Ty, const char_t *>
                       ^
cpplib/core.h:113:23: error: expected ‘{’ before ‘<’ token

is there any specific prerequisites for building the CXX files. hope can get feedbacks, thx

try to use clang 11 but I think "concepts" are not supported there yet

@ASDAlexander77 thx for your reply. i would like to ask several more questions.

  • how much of the TypeScript specification has been supported?
  • i have some similar idea to translate typescript into some other representations. But instead of translating typescript into C/C++, i would like to translate typescript into some bytecode format(something like java/JavaScript bytecode). Do u have any suggestion for that.
  • is there any demo or tutorial which can guide me to traverse the TS AST and generate bytecode?