1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

[Tolk] Support syntax tensorVar.0 and tupleVar.0

It works both for reading and writing:
> var t = (1, 2);
> t.0;      // 1
> t.0 = 5;
> t;        // (5, 2)

It also works for typed/untyped tuples, producing INDEX and SETINDEX.

Global tensors and tuples works. Nesting `t.0.1.2` works. `mutate` works.
Even mixing tuples inside tensors inside a global for writing works.
This commit is contained in:
tolk-vm 2025-01-27 10:29:17 +03:00
parent 565bc59735
commit 7a1602f591
No known key found for this signature in database
GPG key ID: 7905DD7FE0324B12
42 changed files with 1119 additions and 338 deletions

View file

@ -99,21 +99,21 @@ fun main() {
test1 PROC:<{
//
PUSHNULL // numbers
1 PUSHINT // numbers _2=1
SWAP // _2=1 numbers
1 PUSHINT // numbers '2=1
SWAP // '2=1 numbers
CONS // numbers
2 PUSHINT // numbers _4=2
SWAP // _4=2 numbers
2 PUSHINT // numbers '4=2
SWAP // '4=2 numbers
CONS // numbers
3 PUSHINT // numbers _6=3
SWAP // _6=3 numbers
3 PUSHINT // numbers '6=3
SWAP // '6=3 numbers
CONS // numbers
4 PUSHINT // numbers _8=4
SWAP // _8=4 numbers
4 PUSHINT // numbers '8=4
SWAP // '8=4 numbers
CONS // numbers
UNCONS // h numbers
DUP // h numbers numbers
CAR // h numbers _13
CAR // h numbers '13
"""
@fif_codegen
@ -121,11 +121,11 @@ fun main() {
main PROC:<{
//
PUSHNULL // i
ISNULL // _2
ISNULL // '2
IFJMP:<{ //
1 PUSHINT // _3=1
1 PUSHINT // '3=1
}> //
10 PUSHINT // _4=10
10 PUSHINT // '4=10
}>
"""
@ -133,14 +133,14 @@ fun main() {
"""
test7 PROC:<{
...
LDOPTREF // b _8 _7
LDOPTREF // b '8 '7
DROP // b c
ISNULL // b _11
10 MULCONST // b _13
SWAP // _13 b
ISNULL // _13 _14
NOT // _13 _15
ADD // _16
ISNULL // b '11
10 MULCONST // b '13
SWAP // '13 b
ISNULL // '13 '14
NOT // '13 '15
ADD // '16
}>
"""
*/