Skip to content

Commit 5e4ec4e

Browse files
authored
Merge pull request #3 from ton-blockchain/tolk-v0.8
Tolk v0.8 wasm and stdlib
2 parents e3b125b + e800e82 commit 5e4ec4e

File tree

8 files changed

+20
-11
lines changed

8 files changed

+20
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ton/tolk-js",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"description": "Tolk Language compiler (next-generation FunC)",
55
"main": "dist/index.js",
66
"bin": "./dist/cli.js",

src/tolk-stdlib/common.tolk

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Standard library for Tolk (LGPL licence).
22
// It contains common functions that are available out of the box, the user doesn't have to import anything.
33
// More specific functions are required to be imported explicitly, like "@stdlib/tvm-dicts".
4-
tolk 0.7
4+
tolk 0.8
55

66
/**
77
Tuple manipulation primitives.
@@ -21,23 +21,32 @@ fun tuplePush<T>(mutate self: tuple, value: T): void
2121
asm "TPUSH";
2222

2323
/// Returns the first element of a non-empty tuple.
24+
/// `t.0` is actually the same as `t.tupleFirst()`
2425
@pure
25-
fun tupleFirst<T>(t: tuple): T
26+
fun tupleFirst<T>(self: tuple): T
2627
asm "FIRST";
2728

2829
/// Returns the [`index`]-th element of a tuple.
30+
/// `t.i` is actually the same as `t.tupleAt(i)`
2931
@pure
30-
fun tupleAt<T>(t: tuple, index: int): T
32+
fun tupleAt<T>(self: tuple, index: int): T
33+
builtin;
34+
35+
/// Sets the [`index`]-th element of a tuple to a specified value
36+
/// (element with this index must already exist, a new element isn't created).
37+
/// `t.i = value` is actually the same as `t.tupleSetAt(value, i)`
38+
@pure
39+
fun tupleSetAt<T>(mutate self: tuple, value: T, index: int): void
3140
builtin;
3241

3342
/// Returns the size of a tuple (elements count in it).
3443
@pure
35-
fun tupleSize(t: tuple): int
44+
fun tupleSize(self: tuple): int
3645
asm "TLEN";
3746

3847
/// Returns the last element of a non-empty tuple.
3948
@pure
40-
fun tupleLast<T>(t: tuple): T
49+
fun tupleLast<T>(self: tuple): T
4150
asm "LAST";
4251

4352

src/tolk-stdlib/gas-payments.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// A part of standard library for Tolk
2-
tolk 0.7
2+
tolk 0.8
33

44
/**
55
Gas and payment related primitives.

src/tolk-stdlib/lisp-lists.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// A part of standard library for Tolk
2-
tolk 0.7
2+
tolk 0.8
33

44
/**
55
Lisp-style lists are nested 2-elements tuples: `(1, (2, (3, null)))` represents list `[1, 2, 3]`.

src/tolk-stdlib/tvm-dicts.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// A part of standard library for Tolk
2-
tolk 0.7
2+
tolk 0.8
33

44
/**
55
Dictionaries are represented as `cell` data type (cells can store anything, dicts in particular).

src/tolk-stdlib/tvm-lowlevel.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// A part of standard library for Tolk
2-
tolk 0.7
2+
tolk 0.8
33

44
/// Usually `c3` has a continuation initialized by the whole code of the contract. It is used for function calls.
55
/// The primitive returns the current value of `c3`.

src/tolkfiftlib.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tolkfiftlib.wasm

16.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)