{"id":17659810,"url":"https://github.com/raphamorim/js2c-set","last_synced_at":"2025-03-30T10:44:00.946Z","repository":{"id":75482135,"uuid":"70851079","full_name":"raphamorim/js2c-set","owner":"raphamorim","description":"Transform JS to C","archived":false,"fork":false,"pushed_at":"2016-10-13T21:52:00.000Z","size":3343,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T12:41:21.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raphamorim.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-13T21:51:08.000Z","updated_at":"2017-04-17T19:15:00.000Z","dependencies_parsed_at":"2023-06-06T15:15:11.008Z","dependency_job_id":null,"html_url":"https://github.com/raphamorim/js2c-set","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fjs2c-set","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fjs2c-set/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fjs2c-set/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fjs2c-set/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphamorim","download_url":"https://codeload.github.com/raphamorim/js2c-set/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246307929,"owners_count":20756478,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T16:08:20.428Z","updated_at":"2025-03-30T10:44:00.924Z","avatar_url":"https://github.com/raphamorim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js2c - JavaScript to C\n\n#### WORK IN PROGRESS, BUT [YOU CAN HELP](https://github.com/raphamorim/js2c/issues)\n\n\u003e Transform JavaScript in C\n\n[![Coverage Status](https://coveralls.io/repos/github/raphamorim/js2c/badge.svg?branch=master)](https://coveralls.io/github/raphamorim/js2c?branch=master) [![Build Status](https://travis-ci.org/raphamorim/js2c.svg)](https://travis-ci.org/raphamorim/js2c.js)\n\n## Summary\n\n- [Why js2c?](#why)\n- [Getting](#getting)\n- [Usage](#usage)\n  - [Simple Usage](#simple-usage)\n  - [Methods](#methods)\n    - [Parse](#parse)\n    - [Compile](#compile)\n    - [Exec](#exec)\n  - [Notes](#notes)\n- [Roadmap](#roadmap)\n\n## Why?\n\nThe idea is bring the possibility of development to complex platforms like PS4, PS3, PSP and PS Vita using JavaScript to native applications. In a close future JS2C will be able to read and understand external packages.\n\nAnd the other reason: [Why Not?](https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js).\n\n## Getting\n\nVerify if you have [node](https://nodejs.org/en/) and [npm](https://www.npmjs.org/) installed.\n\n```shell\nnpm install js2c\n```\n\n## Usage\n\n### Simple Usage\n\nThen do the Magic.\n\n```javascript\n\nvar js2c = require(\"js2c\"),\n    jsString = \" function sum(a, b){  console.log(a + b) } \";\n\nvar program = js2c(jsString); // returns \"void sum(int x, int y) { printf(\"%d \", x + y); }\"\nprogram.exec(); // Compile String as a C program and Execute Binary\n\n```\n\n### Methods\n\nAbout js2c Methods:\n\n#### Parse\n\nReturn parsed strings without modify/save in JS2C state\n\n```js\n\nvar js2c = require(\"js2c\");\n\njs2c.parse(\"var i = 1\"); // returns \"int i = 1;\"\n\n```\n\n#### Compile\n\nCompile current program, however you can specify the path where compiled program will be stored.\n\n```js\n\nvar js2c = require(\"js2c\"),\n    program = js2c(jsCode);\n\nvar path = \"./bin\";\n\nc.compile(path); // path is optional\n\n```\n\n#### Exec\n\nCreate binary file in memory and execute after it.\n\n```js\n\nvar js2c = require(\"js2c\"),\n    program = js2c(jsCode);\n\nc.exec();\n\n```\n\n### Notes\n\nIMPORTANT: **For while you have to define variable before use it.**\n\n## Roadmap\n\n- [ ] Variable declarations\n  - [x] string\n  - [x] interger\n  - [x] boolean\n  - [x] array\n  - [ ] object\n- [ ] Functions declarations\n  - [ ] callbacks declarations\n  - [ ] closure cases\n- [ ] Native Funcs/Methods (`console`, `import`, `while`, `for`, `Array.length`and much others...)\n- [ ] Modules declarations (import cases)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fjs2c-set","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphamorim%2Fjs2c-set","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fjs2c-set/lists"}