Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tolk v0.8 wasm and stdlib #3

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.