feat(compiler): Add support for targeting WebAssembly.

The working principle is similar as before with x86, but instead of outputting .asm, it outputs .wat. This can be compiled into .wasm by using the wat2wasm assembler.
This commit is contained in:
Veikko Sariola
2020-12-26 23:16:18 +02:00
parent 7e4bcf18e4
commit e4490faa2e
32 changed files with 2138 additions and 170 deletions

View File

@ -0,0 +1,28 @@
package compiler
import (
"github.com/vsariola/sointu"
)
type CompilerMacros struct {
Clip bool
Library bool
Sine int // TODO: how can we elegantly access global constants in template, without wrapping each one by one
Trisaw int
Pulse int
Gate int
Sample int
Compiler
}
func NewCompilerMacros(c Compiler) *CompilerMacros {
return &CompilerMacros{
Sine: sointu.Sine,
Trisaw: sointu.Trisaw,
Pulse: sointu.Pulse,
Gate: sointu.Gate,
Sample: sointu.Sample,
Compiler: c,
}
}