Waux.Lang 0.0.1

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Waux.Lang" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Waux.Lang" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Waux.Lang" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Waux.Lang --version 0.0.1
                    
#r "nuget: Waux.Lang, 0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Waux.Lang@0.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Waux.Lang&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Waux.Lang&version=0.0.1
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.2 123 2/3/2025
0.0.1 103 2/1/2025