toilscript 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +6 -41
- package/bin/{asinit.js → toilinit.js} +11 -11
- package/bin/{asc.js → toilscript.js} +1 -1
- package/dist/cli.d.ts +4 -0
- package/dist/{asc.generated.d.ts → cli.generated.d.ts} +22 -17
- package/dist/{asc.js → cli.js} +25 -8
- package/dist/cli.js.map +7 -0
- package/dist/importmap.json +2 -2
- package/dist/toilscript.generated.d.ts +22 -17
- package/dist/toilscript.js +26 -26
- package/dist/toilscript.js.map +3 -3
- package/dist/transform.d.ts +1 -1
- package/dist/web.js +3 -3
- package/package.json +16 -16
- package/std/README.md +2 -2
- package/std/assembly/index.d.ts +2 -1
- package/std/assembly/rt/README.md +2 -2
- package/std/assembly/rt.ts +1 -1
- package/std/assembly/toilscript.ts +16 -0
- package/std/portable/index.d.ts +1 -1
- package/util/README.md +1 -1
- package/dist/asc.d.ts +0 -4
- package/dist/asc.js.map +0 -7
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.2/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.2/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
|
@@ -1003,7 +1003,7 @@ declare module "types:toilscript/src/diagnostics" {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
declare module "types:toilscript/src/tokenizer" {
|
|
1005
1005
|
/**
|
|
1006
|
-
* @fileoverview A TypeScript tokenizer modified for
|
|
1006
|
+
* @fileoverview A TypeScript tokenizer modified for ToilScript.
|
|
1007
1007
|
*
|
|
1008
1008
|
* The `Tokenizer` scans over a source file and returns one syntactic token
|
|
1009
1009
|
* at a time that the parser will combine to an abstract syntax tree.
|
|
@@ -1227,7 +1227,7 @@ declare module "types:toilscript/src/glue/binaryen" {
|
|
|
1227
1227
|
/**
|
|
1228
1228
|
* @fileoverview Portable definitions for Binaryen's C-API.
|
|
1229
1229
|
*
|
|
1230
|
-
* tsc uses the .js file next to it, while
|
|
1230
|
+
* tsc uses the .js file next to it, while toilscript makes it a Wasm import.
|
|
1231
1231
|
*
|
|
1232
1232
|
* See: https://github.com/WebAssembly/binaryen/blob/main/src/binaryen-c.h
|
|
1233
1233
|
*
|
|
@@ -2069,7 +2069,7 @@ declare module "types:toilscript/src/glue/binaryen" {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
declare module "types:toilscript/src/types" {
|
|
2071
2071
|
/**
|
|
2072
|
-
* @fileoverview Mappings from
|
|
2072
|
+
* @fileoverview Mappings from ToilScript types to WebAssembly types.
|
|
2073
2073
|
* @license Apache-2.0
|
|
2074
2074
|
*/
|
|
2075
2075
|
import { Class, Program, OperatorKind, Function } from "types:toilscript/src/program";
|
|
@@ -2921,7 +2921,7 @@ declare module "types:toilscript/src/resolver" {
|
|
|
2921
2921
|
}
|
|
2922
2922
|
declare module "types:toilscript/src/parser" {
|
|
2923
2923
|
/**
|
|
2924
|
-
* @fileoverview A TypeScript parser for the
|
|
2924
|
+
* @fileoverview A TypeScript parser for the ToilScript subset.
|
|
2925
2925
|
*
|
|
2926
2926
|
* Takes the tokens produced by the `Tokenizer` and builds an abstract
|
|
2927
2927
|
* syntax tree composed of `Node`s wrapped in a `Source` out of it.
|
|
@@ -3067,7 +3067,7 @@ declare module "types:toilscript/src/parser" {
|
|
|
3067
3067
|
}
|
|
3068
3068
|
declare module "types:toilscript/src/program" {
|
|
3069
3069
|
/**
|
|
3070
|
-
* @fileoverview
|
|
3070
|
+
* @fileoverview ToilScript's intermediate representation.
|
|
3071
3071
|
*
|
|
3072
3072
|
* The compiler uses Binaryen IR, which is fairly low level, as its
|
|
3073
3073
|
* primary intermediate representation, with the following structures
|
|
@@ -3137,7 +3137,7 @@ declare module "types:toilscript/src/program" {
|
|
|
3137
3137
|
/** Converts a unary postfix operator token to the respective operator kind. */
|
|
3138
3138
|
function fromUnaryPostfixToken(token: Token): OperatorKind;
|
|
3139
3139
|
}
|
|
3140
|
-
/** Represents an
|
|
3140
|
+
/** Represents an ToilScript program. */
|
|
3141
3141
|
export class Program extends DiagnosticEmitter {
|
|
3142
3142
|
/** Compiler options. */
|
|
3143
3143
|
options: Options;
|
|
@@ -3173,6 +3173,8 @@ declare module "types:toilscript/src/program" {
|
|
|
3173
3173
|
elementsByDeclaration: Map<DeclarationStatement, DeclaredElement>;
|
|
3174
3174
|
/** Element instances by unique internal name. */
|
|
3175
3175
|
instancesByName: Map<string, Element>;
|
|
3176
|
+
/** Function decorated with `@main` (toil module entry point), if any. */
|
|
3177
|
+
mainFunction: FunctionPrototype | null;
|
|
3176
3178
|
/** Classes wrapping basic types like `i32`. */
|
|
3177
3179
|
wrapperClasses: Map<Type, Class>;
|
|
3178
3180
|
/** Managed classes contained in the program, by id. */
|
|
@@ -3487,7 +3489,9 @@ declare module "types:toilscript/src/program" {
|
|
|
3487
3489
|
/** Is compiled lazily. */
|
|
3488
3490
|
Lazy = 1024,
|
|
3489
3491
|
/** Is considered unsafe code. */
|
|
3490
|
-
Unsafe = 2048
|
|
3492
|
+
Unsafe = 2048,
|
|
3493
|
+
/** Is the toil module entry point (`@main`). */
|
|
3494
|
+
Main = 4096
|
|
3491
3495
|
}
|
|
3492
3496
|
export namespace DecoratorFlags {
|
|
3493
3497
|
/** Translates a decorator kind to the respective decorator flag. */
|
|
@@ -4566,7 +4570,7 @@ declare module "types:toilscript/src/bindings/js" {
|
|
|
4566
4570
|
}
|
|
4567
4571
|
declare module "types:toilscript/src/compiler" {
|
|
4568
4572
|
/**
|
|
4569
|
-
* @fileoverview The
|
|
4573
|
+
* @fileoverview The ToilScript compiler.
|
|
4570
4574
|
* @license Apache-2.0
|
|
4571
4575
|
*/
|
|
4572
4576
|
import { Range, DiagnosticEmitter } from "types:toilscript/src/diagnostics";
|
|
@@ -5836,7 +5840,7 @@ declare module "types:toilscript/src/module" {
|
|
|
5836
5840
|
/**
|
|
5837
5841
|
* @fileoverview A thin wrapper around Binaryen's C-API.
|
|
5838
5842
|
*
|
|
5839
|
-
* The
|
|
5843
|
+
* The ToilScript compiler utilizes Binaryen's C-API directly. Even
|
|
5840
5844
|
* though it currently imports binaryen.js, none of the JS APIs it
|
|
5841
5845
|
* provides are used.
|
|
5842
5846
|
*
|
|
@@ -7702,7 +7706,8 @@ declare module "types:toilscript/src/ast" {
|
|
|
7702
7706
|
ExternalJs = 10,
|
|
7703
7707
|
Builtin = 11,
|
|
7704
7708
|
Lazy = 12,
|
|
7705
|
-
Unsafe = 13
|
|
7709
|
+
Unsafe = 13,
|
|
7710
|
+
Main = 14
|
|
7706
7711
|
}
|
|
7707
7712
|
export namespace DecoratorKind {
|
|
7708
7713
|
/** Returns the kind of the specified decorator name node. Defaults to {@link DecoratorKind.CUSTOM}. */
|
|
@@ -8872,7 +8877,7 @@ declare module "types:toilscript/src/bindings" {
|
|
|
8872
8877
|
export { TSDBuilder } from "types:toilscript/src/bindings/tsd";
|
|
8873
8878
|
}
|
|
8874
8879
|
/**
|
|
8875
|
-
* Environment definitions for compiling
|
|
8880
|
+
* Environment definitions for compiling ToilScript to JavaScript using tsc.
|
|
8876
8881
|
*
|
|
8877
8882
|
* Note that semantic differences require additional explicit conversions for full compatibility.
|
|
8878
8883
|
* For example, when casting an i32 to an u8, doing `<u8>(someI32 & 0xff)` will yield the same
|
|
@@ -9392,8 +9397,8 @@ declare module "types:toilscript/src/index-wasm" {
|
|
|
9392
9397
|
* as a flat namespace.
|
|
9393
9398
|
*
|
|
9394
9399
|
* Note though that the compiler sources are written in "portable
|
|
9395
|
-
*
|
|
9396
|
-
* to WebAssembly with
|
|
9400
|
+
* ToilScript" that can be compiled to both JavaScript with tsc and
|
|
9401
|
+
* to WebAssembly with toilscript, and as such require additional glue code
|
|
9397
9402
|
* depending on the target.
|
|
9398
9403
|
*
|
|
9399
9404
|
* When compiling to JavaScript `glue/js/index.js` must be included.
|
|
@@ -9566,7 +9571,7 @@ declare module "types:toilscript/src/extra/ast" {
|
|
|
9566
9571
|
/**
|
|
9567
9572
|
* @fileoverview Abstract Syntax Tree extras.
|
|
9568
9573
|
*
|
|
9569
|
-
* Provides serialization of the
|
|
9574
|
+
* Provides serialization of the ToilScript AST back to it source form.
|
|
9570
9575
|
*
|
|
9571
9576
|
* @license Apache-2.0
|
|
9572
9577
|
*/
|
|
@@ -9676,7 +9681,7 @@ declare module "types:toilscript/src/index-js" {
|
|
|
9676
9681
|
declare module "types:toilscript/src/index" {
|
|
9677
9682
|
/**
|
|
9678
9683
|
* @license
|
|
9679
|
-
* Copyright 2020 Daniel Wirtz / The
|
|
9684
|
+
* Copyright 2020 Daniel Wirtz / The ToilScript Authors.
|
|
9680
9685
|
*
|
|
9681
9686
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9682
9687
|
* you may not use this file except in compliance with the License.
|
|
@@ -9871,7 +9876,7 @@ declare module "types:toilscript/src/glue/src/glue/binaryen" {
|
|
|
9871
9876
|
/**
|
|
9872
9877
|
* @fileoverview Portable definitions for Binaryen's C-API.
|
|
9873
9878
|
*
|
|
9874
|
-
* tsc uses the .js file next to it, while
|
|
9879
|
+
* tsc uses the .js file next to it, while toilscript makes it a Wasm import.
|
|
9875
9880
|
*
|
|
9876
9881
|
* See: https://github.com/WebAssembly/binaryen/blob/main/src/binaryen-c.h
|
|
9877
9882
|
*
|
|
@@ -10787,7 +10792,7 @@ declare function i64_to_f64(value: i64): number;
|
|
|
10787
10792
|
declare function i64_to_string(value: i64, unsigned?: boolean): string;
|
|
10788
10793
|
declare function i64_clone(value: i64): i64;
|
|
10789
10794
|
/**
|
|
10790
|
-
* Environment definitions for compiling
|
|
10795
|
+
* Environment definitions for compiling ToilScript to JavaScript using tsc.
|
|
10791
10796
|
*
|
|
10792
10797
|
* Note that semantic differences require additional explicit conversions for full compatibility.
|
|
10793
10798
|
* For example, when casting an i32 to an u8, doing `<u8>(someI32 & 0xff)` will yield the same
|