Comments (3)
My universal-transpiler tool can already compile a subset of TypeScript into C++.
It would also be possible to convert JavaScript into C++ by combining a TypeScript-to-Python compiler with a Python-to-C compiler.
from ts2c.
The JS-to-C++ via Python is a crazy route. I specifically want a translation that looks nice :) The universal transpiler seems like a very general tool - is it ever supposed to support what ts2c does already?
from ts2c.
The JS-to-C++ via Python is a crazy route
Agree! There are quite a few ways to compile JS to C++ through some other language. For example, I tested ts2hx project and some others and it worked more or less fine. However, size and quality of resulting code is very bad, and considering the huge overhead such compilation brings, I wonder if there is a real scenario where it makes sense to use it.
My universal-transpiler tool can already compile a subset of TypeScript into C++.
Universal-transpiler seems to be a good project, but for now it fails to compile even very basic examples - e.g. concatenation of strings, simple array operations, etc.. Considering my experience with TS2C, it's still a long way until something usable. Nevertheless, good start, keep it up! 👍
It'd be nice if C++ support was also available. I was specifically thinking of supporting Arduino libraries from Typescript, and those are all C++.
Yes, I was thinking of supporting several different transpilation targets, and Arduino and friends (including e.g. ESP8266) were among the primary candidates. But understand me correctly: there are so many shades of C++, and I don't want to go there. What I am talking of here is a tailored transpilation target, so it produces functions "setup()" and "loop()", uses Arduino's String class for working with strings, and so on.
For now I don't have any concrete approach of how to implement this. I was thinking of template overrides, so some of the templates can be overriden depending on the transpilation target (Code Templating used in ts2c explained here). There are many tricky things there though. For example, I'm not sure how RAll would play out with escape analysis I am using for memory management. Type recognition also changes a bit when we introduce those C++ classes.
Have to say, my personal current goal is to bring coverage of ES3 up to 96-99%, and only after this I will start improving other areas, so it's still a long way until transpilation targets engine (unless community contributes this part sooner).
from ts2c.
Related Issues (20)
- Calling C Functions
- Feature: Classes (for TS at least) HOT 8
- Finishing ES3 features once and for all HOT 6
- Compiling TypeScript to C via WebAssembly HOT 2
- Please include the original code as a comment in the transpiled code HOT 12
- Memory allocation bug HOT 6
- Function.prototype.toString HOT 1
- C functions HOT 2
- Syntax errors are handled incorrectly
- Playground autocomplete keeps repeating
- Order in which properties are added is not honored
- Incorrect generation of 'free' call
- Using C++ instead of C? HOT 4
- npm - Unexpected end of JSON
- Error when combining "for in" and "for of"
- labelled statements don't work
- Ain't work HOT 1
- arguments array ain;t work
- problem with functions called main
- error with functions returning functions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts2c.