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 type expressions in let bindings #37

Open cvauclair opened 3 years ago

cvauclair commented 3 years ago

Description

The Mesh Language should support type annotations (via type expressions) in let bindings to help the type checker when a type cannot be inferred.

Example:

let (x: int) = 2;

let (f: int => int) = (x) => x + 1;

Tentative approach: Modify the let binding definition to include optional type annotations.

// Old ELet
type expr = 
  | ELet(pattern, expr)
  ...
;

// New ELet
type expr = 
  | ELet(pattern, expr, option(typ))
  ...
;
cvauclair commented 3 years ago

@ThierryBleau can you review the tentative approach outlined above?