{"id":17786155,"url":"https://github.com/dcodeio/asc-native","last_synced_at":"2025-03-16T05:31:08.814Z","repository":{"id":65990066,"uuid":"319784430","full_name":"dcodeIO/asc-native","owner":"dcodeIO","description":"AssemblyScript, JavaScript, WebAssembly, C, Binaryen, WABT, Clang, LLVM, CMake, Node.js, Visual Studio and Win32 walk into a bar...","archived":false,"fork":false,"pushed_at":"2020-12-09T17:48:53.000Z","size":729,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-27T05:11:52.434Z","etag":null,"topics":["assemblyscript","webassembly"],"latest_commit_sha":null,"homepage":"","language":"C","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/dcodeIO.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":"2020-12-08T23:12:22.000Z","updated_at":"2024-10-18T12:13:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"afbe3d15-cea7-463a-bcd6-2f581ff8eeab","html_url":"https://github.com/dcodeIO/asc-native","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/dcodeIO%2Fasc-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcodeIO%2Fasc-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcodeIO%2Fasc-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcodeIO%2Fasc-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcodeIO","download_url":"https://codeload.github.com/dcodeIO/asc-native/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806122,"owners_count":20350773,"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":["assemblyscript","webassembly"],"created_at":"2024-10-27T09:04:53.972Z","updated_at":"2025-03-16T05:31:08.808Z","avatar_url":"https://github.com/dcodeIO.png","language":"C","readme":"asc native\n==========\n\nThis is an experiment compiling the AssemblyScript compiler to a native executable\nby first compiling the AssemblyScript compiler to WebAssembly using the AssemblyScript\ncompiler compiled to JavaScript, then converting the emitted Wasm binary to C using\nwasm2c and compiling it to native along a native frontend feeding it teh codez.\n\n**Caveats:** Since AssemblyScript links with Binaryen compiled to WebAssembly, and as\nsuch assumes 32-bit pointers everywhere, we need to compile Binaryen to 32-bit, in\nturn compiling the entire thing to a 32-bit executable.\n\n**Status:** It compiles and runs but doesn't yet feed teh codez, producing the following\nperfectly expected abort:\n\n```\nabort: Missing standard library component: ArrayBuffer in src/program.ts at line 1467:19\n```\n\nBuilding on Windows\n-------------------\n\n**Why?** Because unnecessary complexity and stacking layers is kinda the theme here.\nMay also work on *nixes with -T and -A amended.\n\nStep 0: Make sure you have\n\n* Clang build tools for Visual Studio. I used VS 2019 and checkboxed the feature.\n* CMake, Clang/LLVM, Node.js\n* All the submodules\n\nStep 1: Build the Binaryen submodule (32-bit)\n\n```sh\ncd binaryen\nmkdir build\ncd build\ncmake .. -DCMAKE_BUILD_TYPE=Release -T ClangCL -A Win32\ncmake --build .\n```\n\nStep 2: Build the WABT submodule\n\n```sh\ncd wabt\ngit submodule update --init\nmkdir build\ncd build\ncmake .. -DCMAKE_BUILD_TYPE=Release\ncmake --build .\n```\n\nStep 3: Build the AssemblyScript compiler to Wasm\n\n```sh\ncd assemblyscript\nnpm install\nnpm run asbuild:untouched\n```\n\nStep 4: Transpile the AssemblyScript compiler compiled to Wasm to C\n\n```sh\nwabt/bin/wasm2c assemblyscript/out/assemblyscript.untouched.wasm -o src/assemblyscript.c\n```\n\nStep 5: Post-process the generated C sources. Links `binaryen.xy` imports to the Binaryen DLL.\n\n```sh\nnode scripts/post.js\n```\n\nStep 6: Build the project itself (32-bit)\n\n```sh\nmkdir build\ncd build\ncmake .. -T ClangCL -A Win32\ncmake --build .\n```\n\nStep 7: Go find your shiny asc.exe.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcodeio%2Fasc-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcodeio%2Fasc-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcodeio%2Fasc-native/lists"}