# Play: A new programming language. Compiler written in Elm

**URL:** <https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550>\
**Category:** Show and Tell\
**Created:** [November 23, 2020, 11:26am UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550 "2020-11-23T11:26:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![robin.heggelund](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/robin.heggelund/32/1330_2.png) [@robin.heggelund](https://discourse.elm-lang.org/u/robin.heggelund)\
**Post date:** [November 23, 2020, 11:26am UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/1 "2020-11-23T11:26:19Z")

</div>

Today is the first release of Play, a new programming language which is statically typed and compiles to web assembly.

Sharing it here as the compiler is written in Elm. I’ll probably do a write up in a couple of weeks how Elm influenced Play.

[Play website](https://www.play-lang.dev/)

---

<div class="post-metadata">

**Author:** ![eimfach](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/eimfach/32/3247_2.png) [@eimfach](https://discourse.elm-lang.org/u/eimfach)\
**Post date:** [November 23, 2020, 4:08pm UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/2 "2020-11-23T16:08:16Z")

</div>

Cool! What was your intention to create this ?

---

<div class="post-metadata">

**Author:** ![robin.heggelund](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/robin.heggelund/32/1330_2.png) [@robin.heggelund](https://discourse.elm-lang.org/u/robin.heggelund)\
**Post date:** [November 23, 2020, 5:35pm UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/3 "2020-11-23T17:35:11Z")

</div>

In the beginning my intention was to experiment and have fun. But right now I’m hoping trying to turn this into a general purpose programming language which can be useful for CLI, backend and frontend programming.

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [November 23, 2020, 8:47pm UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/4 "2020-11-23T20:47:22Z")

</div>

> [@robin.heggelund](#):
>
> Sharing it here as the compiler is written in Elm.

That is very cool.

I am curious, did you generate the web assembly output from Elm too? Is this a binary output? Or does it output web assembly op-codes to a text file, and then you run it through some web assembly assembler/linker step from there? (I have no idea really about web assembly so perhaps that is not even how its tool chain works…).

Just curious, as some code in Elm for generated web assembly could be interesting… 🙂

---

<div class="post-metadata">

**Author:** ![robin.heggelund](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/robin.heggelund/32/1330_2.png) [@robin.heggelund](https://discourse.elm-lang.org/u/robin.heggelund)\
**Post date:** [November 23, 2020, 9:28pm UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/5 "2020-11-23T21:28:26Z")

</div>

The compiler outputs web assembly text format, which is then converted into binary format by a js-library and loaded into the browser (compiling from files is the focus of alpha-2).

The compiler could’ve compiled to binary wasm directly, but text is a bit easier to debug for a human.

---

<div class="post-metadata">

**Author:** ![ursi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/ursi/32/3166_2.png) [@ursi](https://discourse.elm-lang.org/u/ursi)\
**Post date:** [November 29, 2020, 7:19pm UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/6 "2020-11-29T19:19:29Z")

</div>

Very cool! I only recently learned about Forth but I thought it was really neat, so I’m happy to see this. I’m curious, what made you choose Elm to write the compiler in?

---

<div class="post-metadata">

**Author:** ![robin.heggelund](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/robin.heggelund/32/1330_2.png) [@robin.heggelund](https://discourse.elm-lang.org/u/robin.heggelund)\
**Post date:** [November 30, 2020, 7:13am UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/7 "2020-11-30T07:13:47Z")

</div>

Two reasons:

1. I love Elm and try to use it for as much as I can.

2. Play is going to have a similar runtime as Elm (immutable, controlled side effects), and since the long term goal is to implement Play in Play, it seemed like a good idea that the first implementation of the compiler followed many of the same restrictions.

---

<div class="post-metadata">

**Author:** ![Janiczek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/janiczek/32/4516_2.png) [@Janiczek](https://discourse.elm-lang.org/u/Janiczek)\
**Post date:** [December 2, 2020, 3:45pm UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/8 "2020-12-02T15:45:39Z")

</div>

> [@robin.heggelund](#):
>
> and try to use it for as much as I can.

Totally OT, but I’m glad I hear somebody else voicing this. 😅

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [December 12, 2020, 3:45pm UTC](https://discourse.elm-lang.org/t/play-a-new-programming-language-compiler-written-in-elm/6550/9 "2020-12-12T15:45:47Z")

</div>

Closed on December 12, 2020, 3:45pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
