Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/glebbash/LO
- Owner: glebbash
- Created: 2021-12-25T13:09:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-19T13:51:29.000Z (4 months ago)
- Last Synced: 2024-05-19T14:48:30.386Z (4 months ago)
- Topics: compiler, language, webassembly
- Language: Rust
- Homepage:
- Size: 33.4 MB
- Stars: 15
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
LO - small programming language targeting WASM that aims to be as simple as possible
## ๐ 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## ๐ชต Development Log
๐งพ [Parts [0..6] - Building the initial compiler. (text based blog)](https://carrot-blog.deno.dev/?tag=lo)
๐บ [Parts [7..] - Building the self-hosted compiler. (YouTube playlist)](https://youtube.com/playlist?list=PL6qyEx0ybzWqkc0zG6jVgRx63nZkdu3DP&si=X8OyuWQ8TNDrfikL)
## ๐ Overview
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
### Option 1 (recommended): Using VS Code extension only
> 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`### Option 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`### Option 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`## ๐ฆ 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)## ๐ฆ Building the initial compiler
- Requirements:
- Install [rustup](https://www.rust-lang.org/tools/install)
- Install nightly: `rustup toolchain install nightly`
- Add WASM target: `rustup +nightly target add wasm32-unknown-unknown`
- You can also find configs for GitHub Codespaces and GitPod in this repo
- Run `./build.sh`> This will build the compiler with cargo, putting resulting WASM binary into `lo.wasm`
## ๐งช Running tests
- Requirements:
- Install [Node.js](https://nodejs.org/en/download/package-manager) for running tests
- Run `./utils.mjs test`> This runs tests defined in `utils.mjs`. Test programs are located in `examples/test`