This is an experiment, solidity syntax is so ugly that I rather (try) build something new from scratch
-
Simplicity: We are developing a language that is easy to understand and use, with minimal syntax and an uncluttered design. The Lisp-like syntax, using parenthesized prefix notation (S-expressions), reduces the learning curve for developers familiar with Lisp or other functional programming languages.
-
Security: Our language prioritizes security, incorporating mechanisms that help developers write secure smart contracts. This includes protection against common smart contract vulnerabilities, explicit error handling, and support for formal verification to ensure the correctness of the code.
-
Auditability: We are designing the language to facilitate code readability and auditability, making it easier for developers and auditors to review smart contracts. The use of a Lisp-like syntax and a focus on simplicity contributes to this goal.
-
Strong Typing: Our language retains strong typing, similar to Rust, to minimize runtime errors and improve overall code safety. This feature promotes more robust smart contract development and reduces the likelihood of unexpected behavior.
-
EVM Compatibility: The language is being developed to target the Ethereum Virtual Machine (EVM), enabling seamless integration with the Ethereum ecosystem and making it suitable for creating smart contracts on the Ethereum network.
## Syntax and grammar (WIP)
Declare global variables.
(defvar x uint256)
Declare constants.
(defconst PI 3.14159)
Declare local variables
(let (x uint256 10)
(* x 2))
Delcare a function with visibility
(defun :external add (a uint256 b uint256) -> uint256
(+ a b))
Logical AND
(and (> x 0) (< x 10))
Logical OR
(or (= x 0) (= x 10))
Logical NOT
(not (= x 0))
Conditional expressions
(if (< x 0)
(- x)
x)
Apply a function to each element of a list
(map (fn (x uint256) -> uint256 (* x 2)) my_list)
Filter a list based on a predicate a function
(filter (fn (x uint256) -> bool (= (mod x 2) 0)) my_list)
Declare an event
(event Transfer (from to value))
Emit an event
(emit Transfer from to value)
Iterate through a range
(for (i uint256 0) (< i 10) (set i (+ i 1))
(do-something i))
Loop while a condition is true.
(while (< x 10)
(set x (+ x 1)))
Define an interface.
(definterface IERC20
(function transfer (to address value uint256) -> bool))