Code Monkey home page Code Monkey logo

Comments (4)

pitust avatar pitust commented on August 22, 2024 2

I agree, however it could also be useful to just write C FFI/C declarations.

from ts2c.

andrei-markeev avatar andrei-markeev commented on August 22, 2024

http and sockets are target specific.

how I see it:

  1. there's TS2C transpiler (this project) which is a generic transpiler that doesn't know anything about target platform
  2. there are also TS2C target projects that handle platform-specific stuff, for example there's currently one example target - ESP32: https://github.com/andrei-markeev/ts2c-target-esp-idf (WIP)
  3. then in addition to this, there might be some helper wrappers that simplify access to target platform features. for example it might be implementation of fetch for ESP32 with same syntax as the fetch we have in browser

so what you are suggesting is rather p.3

I mean, not against it at all, but for now I'm concentrating on the transpiler part, and it is a gigantic effort to implement even just the ES3 spec...

from ts2c.

pitust avatar pitust commented on August 22, 2024

Well, After implementing ES3, you can run babel and typescript to turn ESnext to ES3.
Also, I think I found some issues and have fixes for them but I patched my local ts2c implementation so IDK. Also, I have came up with a series of tricks to get 64-bit intagers and C FFI for use in an OS, see js-os. It also patches the input JS and the ouput C quite a bit.

from ts2c.

andrei-markeev avatar andrei-markeev commented on August 22, 2024

interesting project! 👍

yes, basically this patching as in cpatch.js is more or less what a TSC target would do.

C FFI is also done in TSC target, already possible via type definitions, example here: https://github.com/andrei-markeev/ts2c-target-esp-idf/tree/master/headers

from ts2c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.