Giter Site home page Giter Site logo

mattslaney / wasm-clang Goto Github PK

View Code? Open in Web Editor NEW

This project forked from binji/wasm-clang

0.0 0.0 0.0 49.5 MB

Running Clang/LLD in WebAssembly Demo

Home Page: https://binji.github.io/wasm-clang

License: Apache License 2.0

JavaScript 74.46% C++ 13.41% C 1.04% CSS 0.74% HTML 10.35%

wasm-clang's Introduction

Clang/LLD in WebAssembly

This is the demo for my CppCon 2019 talk! You can view the talk on youtube

Thing should work, but it's still very much alpha demoware. Go to https://binji.github.io/wasm-clang to see it in action.

Most of the JavaScript code can be found here. If you're interested in the implementation of the in-memory filesystem, take a look at https://github.com/binji/llvm-project/tree/master/binji.

Some notes on how I built this, sorry that they are relatively sparse: https://gist.github.com/binji/b7541f9740c21d7c6dac95cbc9ea6fca

Directory structure

Shared utilities

  • clang: clang compiler, compiled to wasm w/ WASI
  • lld: lld linker, compiled to wasm w/ WASI
  • main.css
  • memfs: WASI implementation of in-memory filesystem,
  • shared.js: shared utilities for all tools (web and d8)
  • shared_web.js: shared utilities for all web tools (asm.html, index.html, etc.)
  • sysroot.tar: C++ standard headers and libraries
  • service_worker.js: Service worker used by all web pages
  • worker.js: Dedicated work used to compile/run

Assemble 6502 code

  • 6502.html
  • 6502.js
  • vasm6502_oldstyle: vasm assembler compiled to wasm w/ WASI

Compile C++ code to x86/wasm assembly

  • asm.html
  • asm.js

Compile C++ code in d8 (v8's console shell)

  • d8.js

Compile and run C++ code

  • index.html
  • web.js

wasm-clang's People

Contributors

binji avatar leoleoasd avatar nikhil1920 avatar

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.