-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[builtin] add
@
as prefix to all builtins
- Loading branch information
Showing
97 changed files
with
195 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
src/lang/builtins/defineOperatorPrivate.ts → src/lang/builtins/defineBuiltinOperator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
import { ComposeOptions } from "../compose/compose" | ||
import { Env } from "../env" | ||
import { Mod } from "../mod" | ||
import { define } from "../mod/define" | ||
|
||
export function defineOperatorPrivate( | ||
export function defineBuiltinOperator( | ||
mod: Mod, | ||
name: string, | ||
options: { | ||
compose: (env: Env, options: ComposeOptions) => void | ||
}, | ||
): void { | ||
define(mod, name, { | ||
mod.builtins.set(name, { | ||
"@type": "Definition", | ||
"@kind": "OperatorDefinition", | ||
mod, | ||
name, | ||
compose: options.compose, | ||
isPrivate: true, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { Mod } from "../mod" | ||
import * as Type from "./Type" | ||
import * as connect from "./connect" | ||
import { defineOperatorPrivate } from "./defineOperatorPrivate" | ||
import { defineBuiltinOperator } from "./defineBuiltinOperator" | ||
import * as inspect from "./inspect" | ||
import * as rot from "./rot" | ||
import * as run from "./run" | ||
import * as swap from "./swap" | ||
|
||
export function defineBuiltinOperators(mod: Mod): void { | ||
defineOperatorPrivate(mod, "swap", swap) | ||
defineOperatorPrivate(mod, "rot", rot) | ||
defineOperatorPrivate(mod, "connect", connect) | ||
defineOperatorPrivate(mod, "inspect", inspect) | ||
defineOperatorPrivate(mod, "run", run) | ||
defineOperatorPrivate(mod, "Type", Type) | ||
defineBuiltinOperator(mod, "swap", swap) | ||
defineBuiltinOperator(mod, "rot", rot) | ||
defineBuiltinOperator(mod, "connect", connect) | ||
defineBuiltinOperator(mod, "inspect", inspect) | ||
defineBuiltinOperator(mod, "run", run) | ||
defineBuiltinOperator(mod, "Type", Type) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
type Trivial -- Type end | ||
type Trivial -- @Type end | ||
node sole -- Trivial :value! end | ||
|
||
sole connect | ||
sole @connect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
inspect | ||
@inspect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
type Trivial -- Type end | ||
type Trivial -- @Type end | ||
node sole -- Trivial :value! end | ||
|
||
sole sole rot | ||
sole sole @rot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
type Trivial -- Type end | ||
type Trivial -- @Type end | ||
node sole -- Trivial :value! end | ||
|
||
sole swap | ||
sole @swap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
type Trivial -- Type end | ||
type Trivial -- @Type end | ||
node sole -- Trivial :value! end | ||
|
||
sole sole connect | ||
sole sole @connect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
type Nat -- Type end | ||
type Nat -- @Type end | ||
node zero -- Nat :value! end | ||
node add1 Nat :prev -- Nat :value! end | ||
|
||
type Trivial -- Type end | ||
type Trivial -- @Type end | ||
node sole -- Trivial :value! end | ||
|
||
sole add1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
claim swapswap 'A 'B -- 'B end | ||
define swapswap swap swap end | ||
define swapswap @swap @swap end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.