Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/glebbash/lo

LO - small programming language targeting WASM that aims to be as simple as possible
https://github.com/glebbash/lo

compiler language webassembly

Last synced: about 2 months ago
JSON representation

LO - small programming language targeting WASM that aims to be as simple as possible

Awesome Lists containing this project

README

        



LO - small programming language targeting WASM that aims to be as simple as possible

- [🏆 Goals](#-goals)
- [🪵 DevLog + Docs](#-devlog--docs)
- [👀 Examples](#-examples)
- [🚀 Getting started](#-getting-started)
- [🔦 VSCode extension](#-vscode-extension)
- [❔ More info](#-more-info)

## 🏆 Goals

- Make both the language and the compiler small and easy to understand
- Have little to no dependencies
- Be easy to use and modify
- Emit WASM to have the biggest target coverage with little code
- Document the process

## 🪵 DevLog + Docs

The journey is documented in the [LO DevLog](https://carrot-blog.deno.dev/?tag=lo).

And the actual docs for the compiler are in the [docs](./docs/README.md) folder.

## 👀 Examples

Check out example `.lo` programs including standard library sources and WIP self-hosted compiler in the [./examples](./examples/) folder.

Here are some of them with syntax highlighting from the [LO VS Code extension](#vscode-extension):

- Hello world [(source)](examples/test/demos/hello-world.lo):

![Hello World sample](./docs/assets/hello-world.png)

- Advent of Code 2020 Day 1 [(source)](examples/test/demos/hello-world.lo):

![AOC 2020 sample](./docs/assets/aoc-2020-day1.png)

- Dark Maze (WASM-4 demo game) [play it here](https://rawcdn.githack.com/glebbash/LO/da8305293f5438967619e91c6ecfd472111ccf91/examples/test/demos/wasm4/builds/dark-maze.html) or check the [source](examples/test/demos/wasm4/src/dark-maze.lo):

![Dark Maze gif](./docs/assets/dark-maze.gif)

## 🚀 Getting started

1️⃣ Using VS Code extension (recommended)

> This option also works in vscode.dev

- Install the [LO VS Code extension](#vscode-extension)
- To create a new project: Open empty folder, execute Command Palette: `LO: Initialize project in current workspace`
- To run currently open file: execute Command Palette: `LO: Run current file`, or press ▶️ button in the top toolbar
- Compiling files:
- Open Web Shell: execute Command Palette: `Terminal: Create New Web Shell`
- Run: `run lo.wasm .lo > .wasm`

---

2️⃣ Using wasmtime

- Install [wasmtime](https://github.com/bytecodealliance/wasmtime)
- Compiling files: `wasmtime --dir=. lo.wasm .lo > .wasm`
- Getting diagnostics (in json format): `wasmtime --dir=. lo.wasm .lo --inspect`

---

3️⃣ Using Node.js

- Install [Node.js](https://github.com/bytecodealliance/wasmtime)
- Compiling files: `./utils.mjs compile .lo > .wasm`
- Compiling & running files: `./utils.mjs run .lo`

---

> Additional info on compiler usage is in the [docs](./docs/README.md)

## 🔦 VSCode extension

Available on:
- [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=glebbash.lo)
- [Open VSX Registry](https://open-vsx.org/extension/glebbash/lo)

> See [Inspection](./docs/README.md#52-inspecting-code-ide-intergration) if you are interested in intergrating with other IDEs

## ❔ More info

More info including building initial compiler and running tests is available in the [docs](./docs/README.md)