• Stars
    star
    17
  • Rank 1,257,181 (Top 25 %)
  • Language
    Haskell
  • License
    BSD 3-Clause "New...
  • Created about 7 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Experiment to compile something Elm-ish to Wasm

Elmish Wasm Experiment

What is this all about?

Web assembly is promising new web technology. Elm is a programming language. Lots of people in the Elm community expect Elm to one day compile to web assembly. This repo is an experiment to see what potential there is for Elm to compile to web assembly.

How can we make Elm compile to Web Assembly?

I dont know. Thats a really big task. Lets start small.

A lot of people talk about Web Assembly as if its C++ that runs in the browser. Thats not the case. Web Assembly (or "wasm") is human-unreadable bytecode. There is a human-readable version of wasm, called wat. It looks like this..

;; A function that adds two numbers
(module
  (func $addTwo (param i32 i32) (result i32)
    get_local 0                     
    get_local 1          
    i32.add
  )       
  (export "addTwo" (func $addTwo))
)

Reading that code line by line, it goes something like this..

Theres a function called addTwo it takes two int parameters and returns and int. 
First it gets the first parameter,
then it gets the second parameter,
and then it adds the parameters. 
Export addTwo into JavaScript world and name it "addTwo".

So to start small, lets make something that merely looks like Elm- we will call it "Elmish"- and compile it to wat. I imagine an Elmish program that compiles to the wat code above looking like this:

module Main exposing (addTwo)


addTwo : Int -> Int -> Int
addTwo a b =
    a + b

Making a compiler that compiles Elmish to wat is what I am trying to do.

Update : 20180217

Much of what this repo did was reading Elm files with Haskell and Regex, and parsing out the syntax. Thats already what the Elm compiler does, so perhaps its not that valuable of work. Moving forward, one could just hack the Elm compiler to compile to a different target. But rather than that, maybe a different direction entirely is called for: See here: https://gist.github.com/Chadtech/c966d30613c588ef2dc45026a1e29731

More Repositories

1

elm-money

All the worlds currencies.
Elm
13
star
2

CtPaint-Desktop

The non-paint app part of CtPaint
Elm
11
star
3

mail

Making Elm ports act like Http requests
JavaScript
11
star
4

CtPaint-App

An image editor that runs in the browser
Elm
10
star
5

CtPaint

CtPaint is paint software that runs in your browser. Use it at CtPaint.us
CoffeeScript
9
star
6

Himesama

Himesama is a YhavaScript library for building user interfaces. Its just like React, except components re-render in response to a single global state (like in redux) rather than states distributed to each component.
CoffeeScript
9
star
7

elm-relational-database

Manage remote data with ids in your front end
Elm
9
star
8

Ct-Color-Scheme-for-Sublime-Text

The Standard Chadtech Colors, and the Standard Chadtech Font, as a sublime color scheme.
8
star
9

Orbiter-d

Orbiter d is a space ship video game centered around maintaining orbit and collecting resources. (chadtech.us/orbiter-13).
Elm
8
star
10

elm-prac-b

Short for 'Elm Practice 11', this is a space ship game wherein the user must collect resources orbiting a planet and overcome the difficulty of maintaining good orbits!
Elm
7
star
11

gulp-elm-starter-project

Template Elm app using gulp
Elm
7
star
12

elm-vector

Collection types of a fixed length
Elm
7
star
13

elm-css-grid

Simple grid system in elm-css
Elm
6
star
14

elm-bool-extra

Convenience functions for working with Bools in Elm
Elm
6
star
15

elm-imperative-porting

While loops in Elm
Elm
5
star
16

Complicated-Form-Demo-in-Elm

Elm
4
star
17

return

(DEPRECIATED) Helpers for update function return values
Elm
4
star
18

elm-gulp-coffeescript-stylus-lodash-browserify-boilerplate

Chadtech's Elm Boilerplate
CoffeeScript
4
star
19

Chadtech-v1.70--Noitech-JS-EDITION

JavaScript
3
star
20

id

An id type for types with ids
Elm
3
star
21

prelude-elm

Haskell
3
star
22

desert-code-camp-session

JavaScript
3
star
23

haskell-write-sine

Haskell
3
star
24

Radler-ui

Haskell
3
star
25

FIGHT-LINES-DEPR-

Rust
3
star
26

chadtech.us

Elm
2
star
27

bellsTemplate

CoffeeScript
2
star
28

ChadTech-vMLGI

ChadTech Space Program
Python
2
star
29

Humio-Just-Intonation-Lightning-talk-Engineering-Meetup-Sept-2019

JavaScript
2
star
30

jasper-birthday

HTML
2
star
31

elm-europe-2019-talk

Elm
2
star
32

Tieugra

Elm
2
star
33

elm-us-state-abbreviations

US State abbreviations and helper functions for those
Elm
2
star
34

ct-os

A little operating system that runs in your browser
Elm
2
star
35

Chadtech-v0.5

JavaScript
2
star
36

chadtechs-flat-elm-architecture

Elm
2
star
37

Radler-Engine

Haskell
2
star
38

Moonlander-Game-Idea

Python
2
star
39

white-space-c

Haskell
2
star
40

unique-list

A type to arrange things in order
Elm
2
star
41

their-feed

JavaScript
2
star
42

ChadTech-vSatz

Simple text editor for quick access to math and logic symbols
Python
2
star
43

random-pipeline

This is a package that makes getting random values a little bit easier in Elm.
Elm
2
star
44

Homespun

Haskell
1
star
45

kargo-project

TypeScript
1
star
46

elm-prac-2-moonlander

JavaScript
1
star
47

ctpaint-elm-sign-up

JavaScript
1
star
48

design-critique-night

JavaScript
1
star
49

Ct-Calculator

JavaScript
1
star
50

ctpaint-keys

Elm
1
star
51

elm-online-talk-july-2021

Elm
1
star
52

tuple-infix

Infix functions to tuple in Elm
Elm
1
star
53

Philosophical-Comment-of-20141027

CSS
1
star
54

ChadTech-v0

Python
1
star
55

hilbert-engine

Haskell
1
star
56

resume

Elm
1
star
57

elm-spa-starter

A Template Elm SPA.
Elm
1
star
58

haskell-prac

Haskell
1
star
59

Ntv1.bcpp

Python
1
star
60

MSpaintXP

This is an untampered version of MS paint from windows XP. Just download the exe and run it, no installation necessary.
1
star
61

CtDPVOUFSQPJOU00

CoffeeScript
1
star
62

Fit-Log-IV

JavaScript
1
star
63

CTDAW4OR

JavaScript
1
star
64

elm-prac-7

JavaScript
1
star
65

CTDAW2OR

JavaScript
1
star
66

elm-prac-9

JavaScript
1
star
67

hfnss

Monospace Pixel Font data in Elm
Elm
1
star
68

dopna

C++
1
star
69

native-elm-demo

JavaScript
1
star
70

MNMBCTTJUFAF

JavaScript
1
star
71

LMSchedule

1
star
72

Iconoclast

CoffeeScript
1
star
73

CtDPNQPTFSvA.0

JavaScript
1
star
74

stl-prac

CoffeeScript
1
star
75

seinfeldJS

1
star
76

Chadtech-Online-2

Elm
1
star
77

random-pcg-pipeline

This is a package that makes getting random values a little bit easier in Elm.
Elm
1
star
78

Person-Management

JavaScript
1
star
79

ct-colors

Chadtech Standard Colors in an Elm package
Elm
1
star
80

HImesama-example

1
star
81

elm-canvas-ports-experiment

Elm
1
star
82

bellsAugust

CoffeeScript
1
star
83

elm-gulp-browserify-boilerplate

My Elm project boiler plate, using gulp and browserify
JavaScript
1
star
84

Ntv1.aJS1

CoffeeScript
1
star
85

Chadtech-v4.00--Ctpiano

Python
1
star
86

ctjs2

JavaScript
1
star
87

parsley-project

Elm
1
star
88

ChadTech-v8.00---Chart-Control

Excellent software for developing one dimensional frequency charts
1
star
89

elm-provider

The container / component pattern in Elm
Elm
1
star
90

LMMembersDataBase

JavaScript
1
star
91

holidayJS-team-HiClass

JavaScript
1
star
92

Ntv1.bYhS2

CoffeeScript
1
star
93

bitcoin-transaction-counter

Elm
1
star
94

FightLines

Rust
1
star
95

chadtech-components-experiment

Elm
1
star
96

Iconoclass-ui-5

JavaScript
1
star
97

rust-prac

Rust
1
star
98

ctsvg

JavaScript
1
star
99

CtDPVOUFSQPJOU02

JavaScript
1
star
100

dependent-text

A dependent text type (sorta)
Elm
1
star