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:
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.
Original source: https://en.wikipedia.org/wiki/FunC.
Read more |