FunC

Short description: Programming Language

FunC is a domain-specific, C-like, statically typed programming language used for smart contract development on the TON blockchain. The language is designed to be similar to C. Programs written in FunC are compiled into Fift assembler code which generates bytecode for the TON Virtual Machine (TVM). The bytecode can be used to create smart contracts on the blockchain or run on a local instance of the TVM.

FunC has a number of built-in types for data storage and manipulation, including:

* int: for 257-bit signed integers, with overflow checks enabled by default.
* cell: the fundamental unit of data storage in the TON blockchain, containing up to 1023 bits of arbitrary data and up to four references to other cells.
* slice: a way to access the data bits and references of a cell.
* builder: used to construct and finalize new cells.
* tuple: an ordered collection of up to 255 components with arbitrary value types.
* cont: used for controlling the flow of program execution in the TVM.

A notable feature of FunC is that it does not have a dedicated boolean type.[1] Instead, booleans are represented as integers with non-zero values representing true and zero representing false. Logical operations are done using bitwise operations. The language also has support for null values, which are represented using TVM type Null.

FunC also has support for type inference, allowing for "holes" in types to be filled during type checking. Complex types can be composed using functional and tensor types. Values of functional type A->B are represented as continuations internally and represent functions with a specified domain and codomain. Tensor types are used to represent ordered collections of values, which can occupy more than one TVM stack entry.

Overall, FunC aims to provide a familiar programming experience for developers while providing a strong type system and low-level control over the TVM, making it well-suited for developing smart contracts on TON blockchain.

## References

1. ↑ "FunC Documentation". 24 January 2023. https://ton.org/docs/develop/func/types.

0.00

(0 votes)

|

Retrieved from "https://handwiki.org/wiki/index.php?title=FunC&oldid=3908387"