Skip to content

Commit

Permalink
Merge pull request #3 from ton-blockchain/tolk-v0.8
Browse files Browse the repository at this point in the history
Tolk v0.8 wasm and stdlib
  • Loading branch information
tolk-vm authored Feb 10, 2025
2 parents e3b125b + e800e82 commit 5e4ec4e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ton/tolk-js",
"version": "0.7.0",
"version": "0.8.0",
"description": "Tolk Language compiler (next-generation FunC)",
"main": "dist/index.js",
"bin": "./dist/cli.js",
Expand Down
19 changes: 14 additions & 5 deletions src/tolk-stdlib/common.tolk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Standard library for Tolk (LGPL licence).
// It contains common functions that are available out of the box, the user doesn't have to import anything.
// More specific functions are required to be imported explicitly, like "@stdlib/tvm-dicts".
tolk 0.7
tolk 0.8

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

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

/// Returns the [`index`]-th element of a tuple.
/// `t.i` is actually the same as `t.tupleAt(i)`
@pure
fun tupleAt<T>(t: tuple, index: int): T
fun tupleAt<T>(self: tuple, index: int): T
builtin;

/// Sets the [`index`]-th element of a tuple to a specified value
/// (element with this index must already exist, a new element isn't created).
/// `t.i = value` is actually the same as `t.tupleSetAt(value, i)`
@pure
fun tupleSetAt<T>(mutate self: tuple, value: T, index: int): void
builtin;

/// Returns the size of a tuple (elements count in it).
@pure
fun tupleSize(t: tuple): int
fun tupleSize(self: tuple): int
asm "TLEN";

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


Expand Down
2 changes: 1 addition & 1 deletion src/tolk-stdlib/gas-payments.tolk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// A part of standard library for Tolk
tolk 0.7
tolk 0.8

/**
Gas and payment related primitives.
Expand Down
2 changes: 1 addition & 1 deletion src/tolk-stdlib/lisp-lists.tolk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// A part of standard library for Tolk
tolk 0.7
tolk 0.8

/**
Lisp-style lists are nested 2-elements tuples: `(1, (2, (3, null)))` represents list `[1, 2, 3]`.
Expand Down
2 changes: 1 addition & 1 deletion src/tolk-stdlib/tvm-dicts.tolk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// A part of standard library for Tolk
tolk 0.7
tolk 0.8

/**
Dictionaries are represented as `cell` data type (cells can store anything, dicts in particular).
Expand Down
2 changes: 1 addition & 1 deletion src/tolk-stdlib/tvm-lowlevel.tolk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// A part of standard library for Tolk
tolk 0.7
tolk 0.8

/// Usually `c3` has a continuation initialized by the whole code of the contract. It is used for function calls.
/// The primitive returns the current value of `c3`.
Expand Down
2 changes: 1 addition & 1 deletion src/tolkfiftlib.js

Large diffs are not rendered by default.

Binary file modified src/tolkfiftlib.wasm
Binary file not shown.

0 comments on commit 5e4ec4e

Please sign in to comment.