Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yjl9903/minimoonbit-moca
Mini Moonbit implementation from 摩卡猫猫
https://github.com/yjl9903/minimoonbit-moca
compilers javascript minimoonbit moonbit programming-language riscv wasm
Last synced: 20 days ago
JSON representation
Mini Moonbit implementation from 摩卡猫猫
- Host: GitHub
- URL: https://github.com/yjl9903/minimoonbit-moca
- Owner: yjl9903
- License: mit
- Created: 2024-10-07T14:19:45.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-24T13:54:05.000Z (29 days ago)
- Last Synced: 2024-11-24T14:20:43.606Z (29 days ago)
- Topics: compilers, javascript, minimoonbit, moonbit, programming-language, riscv, wasm
- Language: Just
- Homepage:
- Size: 20.5 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MiniMoonBit
[![moonbit-check](https://github.com/yjl9903/minimoonbit-moca/actions/workflows/moonbit.yml/badge.svg)](https://github.com/yjl9903/minimoonbit-moca/actions/workflows/moonbit.yml)
Mini Moonbit implementation from 摩卡猫猫.
## Quickstart
Install moonbit compiler.
```bash
curl -fsSL https://cli.moonbitlang.cn/install/unix.sh | bash -s minimoonbit
```Install moonbit VS Code extension `moonbit.moonbit-lang`.
Then:
```bash
moon update
moon install
```Build RISC-V simulator and RISC-V runtime
Make sure you have installed zig 0.13.0 ([here](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager)) and cmake.
```bash
git submodule update --init --recursive
./build_rvlinux.sh
./build_riscvrt.sh
```You will have `rvlinux` linked in the project root directory.
Install WebAssembly text format parser wasm-tools (optional)
Make sure you have installed [Rust toolchains](https://www.rust-lang.org/tools/install).
```bash
cargo install --locked wasm-tools
```## Run
You can directly use the following scripts to run our MiniMoonbit implementation.
```bash
./run_riscv.sh test/test_src/print.mbt
./run_wasm.sh test/test_src/print.mbt
./run_js.sh test/test_src/print.mbt
./run_ssa.sh test/test_src/print.mbt
./run_machine_ir.sh test/test_src/print.mbt
```Run with RSIC-V backend manually.
```bash
moon run src/bin/main.mbt -- -o
zig build-exe -target riscv64-linux -femit-bin= \
/runtime/riscv_rt/zig-out/lib/libmincaml.a \
-O Debug -fno-strip -mcpu=baseline_rv64
rvlinux -n
```Run with JS backend manually.
```bash
moon run src/bin/main.mbt -- --js -o .mjs
node ./js_rt/runtime.mjs .mjs
```Run with WASM backend manually.
```bash
moon run src/bin/main.mbt -- --wasm -o .wat
wasm-tools parse .wat -o .wasm
node ./wasm_rt/runtime.mjs .wasm
```## Test
Install [Just](https://github.com/casey/just?tab=readme-ov-file#packages).
```bash
just test-parse
just test-typecheck
just test-knf
just test-closure
just test-js
just test-wasm
just test-riscv
```## Reference
- Original Repository: [minimoonbit-public](https://github.com/moonbitlang/minimoonbit-public/tree/main)