Skip to content

Commit

Permalink
Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljharvey committed Dec 16, 2023
1 parent f524e25 commit 7f8f57f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,52 @@

Like [llvm-calc](https://github.com/danieljharvey/llvm-calc), but adapting it for learning WASM.

https://github.com/danieljharvey/llvm-calc
Each directory slowly adds features to a calculator that compiles to WASM.

## wasm-calc

Simple numerical expressions

`1 + 2 + 3 * 3`

## wasm-calc2

Basic if expressions

`if 1 == 2 then 7 else 8`

## wasm-calc3

Simple functions

```
function sum(a: Integer, b: Integer) {
a + b
}
sum(1,2)
```

## wasm-calc4

Simple compound types (tuples).

```
function swapPair(pair: (Integer, Boolean)) {
(pair.2, pair.1)
}
if swapPair((100,True)).1 then 7 else 8
```

## wasm-calc5

Floats, use different WASM types

```
function sumPair(pair: (Float,Float)) {
pair.1 + pair.2
}
sumPair((100.0,200.0))
```
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
buildInputs = with haskellPackages; [
hlint
ormolu
# haskell-language-server # this simply does nothing atm
haskell-language-server
ghcid
cabal-fmt
cabal-install
Expand Down

0 comments on commit 7f8f57f

Please sign in to comment.