Waux.Lang
0.0.1
See the version list below for details.
dotnet add package Waux.Lang --version 0.0.1
NuGet\Install-Package Waux.Lang -Version 0.0.1
<PackageReference Include="Waux.Lang" Version="0.0.1" />
<PackageVersion Include="Waux.Lang" Version="0.0.1" />
<PackageReference Include="Waux.Lang" />
paket add Waux.Lang --version 0.0.1
#r "nuget: Waux.Lang, 0.0.1"
#:package Waux.Lang@0.0.1
#addin nuget:?package=Waux.Lang&version=0.0.1
#tool nuget:?package=Waux.Lang&version=0.0.1
WauxLang
WauxLang - A language that compiles to WASM bytecode.
This is currently an experimental language/compiler targeting WASM as it's runtime. Compiler is written in F#.
Should I use this? Probably not.
Why Waux? What does that word mean? How do you pronounce it?
- Pronounced like the English work "walk" 1
- "A Scots word for wake"
- Why Waux?
- Overall, I just needed to call it something.
- But wanted something starting with Wa- to match Wasm, and it wasn't that bad of a word.
Installing from Source
TBD
Installing from Nuget
TBD
Running
TBD
Current Examples
Currently I have basic mathematical operations and function calling working. For the examples below, I'm converting the compiled wasm to wat for visual purposes. But the output of the compiler is wasm byte code.
Adding
5 + 2
Compiles into:
(module
(type $t0 (func (result i32)))
(func $main (export "main") (type $t0) (result i32)
(i32.add
(i32.const 5)
(i32.const 2))))
Subtraction
10 - 2
Compiles into:
(module
(type $t0 (func (result i32)))
(func $main (export "main") (type $t0) (result i32)
(i32.sub
(i32.const 10)
(i32.const 2))))
Operator Precedence
It also currently handles operator precedence:
10 + 10 / 5 * 2 - 1
Compiles into:
(module
(type $t0 (func (result i32)))
(func $main (export "main") (type $t0) (result i32)
(i32.sub
(i32.add
(i32.const 10)
(i32.mul
(i32.div_s
(i32.const 10)
(i32.const 5))
(i32.const 2)))
(i32.const 1))))
Variable Assignments
let x = 42; x
(module
(type $t0 (func (result i32)))
(func $main (export "main") (type $t0) (result i32)
(local $l0 i32)
(local.set $l0
(i32.const 42))
(local.get $l0)))
Function Calls
func main() {
add(1,2);
}
func add(x, y) {
let mul = multi(x, y);
mul + x + y;
}
func multi(z, v) {
z * v;
}
(module
(type $t0 (func (result i32)))
(type $t1 (func (param i32 i32) (result i32)))
(type $t2 (func (param i32 i32) (result i32)))
(func $main (export "main") (type $t0) (result i32)
(call $add
(i32.const 1)
(i32.const 2)))
(func $add (export "add") (type $t1) (param $p0 i32) (param $p1 i32) (result i32)
(local $l2 i32)
(local.set $l2
(call $multi
(local.get $p0)
(local.get $p1)))
(i32.add
(i32.add
(local.get $l2)
(local.get $p0))
(local.get $p1)))
(func $multi (export "multi") (type $t2) (param $p0 i32) (param $p1 i32) (result i32)
(i32.mul
(local.get $p0)
(local.get $p1))))
Code Formatting
This repo currently uses fantomas in order to format the compiler.
- To install the tool
dotnet tool install fantomas
dotnet tool restore
- To run and format everything
./format.bat
- Or
dotnet fantomas -r .
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- FSharp.Core (>= 8.0.301)
- Wasmtime (>= 22.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.