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

Add grammar support for module definition #51

Closed cvauclair closed 2 years ago

cvauclair commented 3 years ago

Description

The Mesh language grammar should support the definition of modules.

Proposed approach

Add a new variant to the expr type EMod(list(expr))

Example

E.g.: The following expression

module M = {
  let x = 1;
  let f = (a) => a;
};

would be parsed as:

EMod(
  ELet(PVar("x"), ELit(Int(1))),
  ELet(PVar("f"), EFun(PVar("a"), EVar("a")))
)