@stagas/mono
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

mono

mono is a low level language for audio expressions that compiles to wasm

🔧 Install · 🧩 Example · 📜 API docs · 🔥 Releases · 💪🏼 Contribute · 🖐️ Help


Install

$ npm i @stagas/mono

-- work in progress --

API

Table of Contents

todo

src/compiler.ts:92-92

todo is a "not implemented" marker for ops

bin

src/compiler.ts:95-98

constructs a binary op of least type type

Parameters

Returns Op

typebin

src/compiler.ts:101-104

constructs a binary op of exact type type

Parameters

Returns Op

eq

src/compiler.ts:107-113

constructs an equality op

Parameters

Returns Op

funcDef

src/compiler.ts:116-123

defines a function

Parameters

Op

src/compiler.ts:126-335

primary optable

Type: OpTable

OpArgs

src/compiler.ts:338-349

arguments optable

Type: OpTable

build

src/compiler.ts:352-365

builds a node under context ctx and optable ops

Parameters

  • node Node
  • ctx Context
  • ops OpTable

Returns SExpr

map

src/compiler.ts:368-372

builds an array of nodes under context ctx and optable ops

Parameters

Returns Array<SExpr>

typeOf

src/typed.ts:31-31

looks up and returns the type of x, if found, otherwise returns type any

Parameters

Returns Type

typeAs

src/typed.ts:34-34

marks sexpr x to be of type type

Parameters

  • type Type
  • x SExpr

cast

src/typed.ts:37-46

creates a cast operation if the given value x doesn't satisfy type

Parameters

  • type Type
  • x SExpr

castAll

src/typed.ts:49-49

casts all values to be of type type

Parameters

  • type Type
  • values ...SExpr

Returns SExpr

hi

src/typed.ts:52-55

returns the highest precision type of the given values

Parameters

  • values ...SExpr

Returns Type

max

src/typed.ts:58-60

returns at least the precision of the given type among the given types

Parameters

  • type Type
  • types ...Array<Type>

Returns Type

top

src/typed.ts:63-67

types an operation with the correct prefix (f32 or i32) and type casts the values to satisfy the op

Parameters

  • type Type
  • ops SExpr

Returns SExpr

infer

src/typed.ts:70-75

infers the type of a token literal string: bool for 0 or 1, i32 for integers and f32 for floats

Parameters

  • x Token

Returns Type

flatten

src/util.ts:4-9

flattens a node that is left hand side recursing on symbol sym

Parameters

Returns Array<Node>

mush

src/util.ts:12-16

Merges or pUSHes obj to array arr

Parameters

Contribute

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2022 stagas

Package Sidebar

Install

npm i @stagas/mono

Weekly Downloads

61

Version

0.1.0

License

MIT

Unpacked Size

239 kB

Total Files

51

Last publish

Collaborators

  • stagas