Protean-Labs / mesh

The Mesh Engine that implements the Mesh Language, a computational language for web3.
Apache License 2.0
1 stars 0 forks source link

Anonymous function parsing #12

Closed cvauclair closed 3 years ago

cvauclair commented 3 years ago

Description

The Mesh Engine should be able to parse anonymous functions (i.e.: function literals, "lambdas"). Moreover, expressions containing variable bindings to anonymous functions should also be successfully parsed.

Syntax:

(ARGS) => BODY                 // Anonymous function
let VAR = (ARGS) => BODY       // Named function (i.e.: bound anonymous function)

Examples:

(a) => a + 1
() => "hello"
(a, b, c) => a

let f = (a) => a + 1